diff options
Diffstat (limited to 'OpenSim/Region/Framework')
68 files changed, 6954 insertions, 2140 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs b/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs new file mode 100644 index 0000000..ccb2a03 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs | |||
@@ -0,0 +1,61 @@ | |||
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 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public interface IAgentStatefulModule | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Returns a list of all the formats (by UUID) that this module | ||
38 | /// can render agent state in. | ||
39 | /// </summary> | ||
40 | List<UUID> GetRenderStateFormats(); | ||
41 | |||
42 | /// <summary> | ||
43 | /// Returns a list (by UUID) of all formats this module can decode | ||
44 | /// to populate it's internal agent-related state. | ||
45 | /// </summary> | ||
46 | List<UUID> GetAcceptStateFormats(); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Render all internally held state for the given agent in the | ||
50 | /// requested format. | ||
51 | /// </summary> | ||
52 | string RenderState(UUID agentID, UUID format); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Populate the internal state for the given agent from the | ||
56 | /// data argument, which is in the specified format. All prior | ||
57 | /// state relating to this agent is removed by this operation. | ||
58 | /// </summary> | ||
59 | bool ReceiveState(UUID agentID, UUID format, string data); | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 84cdc15..50448b4 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -93,14 +93,21 @@ namespace OpenSim.Region.Framework.Interfaces | |||
93 | 93 | ||
94 | void EnableChildAgent(ScenePresence agent, GridRegion region); | 94 | void EnableChildAgent(ScenePresence agent, GridRegion region); |
95 | 95 | ||
96 | <<<<<<< HEAD | ||
97 | GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, | ||
98 | out Vector3 newpos, out string reason); | ||
99 | |||
100 | ======= | ||
96 | GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); | 101 | GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); |
97 | GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); | 102 | GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); |
98 | bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); | 103 | bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); |
104 | >>>>>>> avn/ubitvar | ||
99 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); | 105 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); |
100 | bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent); | 106 | bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent); |
101 | 107 | ||
102 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); | 108 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); |
103 | 109 | ||
110 | bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); | ||
104 | } | 111 | } |
105 | 112 | ||
106 | public interface IUserAgentVerificationModule | 113 | public interface IUserAgentVerificationModule |
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs deleted file mode 100644 index 35cc220..0000000 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ /dev/null | |||
@@ -1,115 +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.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | public interface IEstateDataService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Load estate settings for a region. | ||
39 | /// </summary> | ||
40 | /// <param name="regionID"></param> | ||
41 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
42 | /// <returns></returns> | ||
43 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Load estate settings for an estate ID. | ||
47 | /// </summary> | ||
48 | /// <param name="estateID"></param> | ||
49 | /// <returns></returns> | ||
50 | EstateSettings LoadEstateSettings(int estateID); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Create a new estate. | ||
54 | /// </summary> | ||
55 | /// <returns> | ||
56 | /// A <see cref="EstateSettings"/> | ||
57 | /// </returns> | ||
58 | EstateSettings CreateNewEstate(); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Load/Get all estate settings. | ||
62 | /// </summary> | ||
63 | /// <returns>An empty list if no estates were found.</returns> | ||
64 | List<EstateSettings> LoadEstateSettingsAll(); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Store estate settings. | ||
68 | /// </summary> | ||
69 | /// <remarks> | ||
70 | /// This is also called by EstateSettings.Save()</remarks> | ||
71 | /// <param name="es"></param> | ||
72 | void StoreEstateSettings(EstateSettings es); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Get estate IDs. | ||
76 | /// </summary> | ||
77 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
78 | /// <returns></returns> | ||
79 | List<int> GetEstates(string search); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Get the IDs of all estates owned by the given user. | ||
83 | /// </summary> | ||
84 | /// <returns>An empty list if no estates were found.</returns> | ||
85 | List<int> GetEstatesByOwner(UUID ownerID); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Get the IDs of all estates. | ||
89 | /// </summary> | ||
90 | /// <returns>An empty list if no estates were found.</returns> | ||
91 | List<int> GetEstatesAll(); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Link a region to an estate. | ||
95 | /// </summary> | ||
96 | /// <param name="regionID"></param> | ||
97 | /// <param name="estateID"></param> | ||
98 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
99 | bool LinkRegion(UUID regionID, int estateID); | ||
100 | |||
101 | /// <summary> | ||
102 | /// Get the UUIDs of all the regions in an estate. | ||
103 | /// </summary> | ||
104 | /// <param name="estateID"></param> | ||
105 | /// <returns></returns> | ||
106 | List<UUID> GetRegions(int estateID); | ||
107 | |||
108 | /// <summary> | ||
109 | /// Delete an estate | ||
110 | /// </summary> | ||
111 | /// <param name="estateID"></param> | ||
112 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
113 | bool DeleteEstate(int estateID); | ||
114 | } | ||
115 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs deleted file mode 100644 index 8febb13..0000000 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ /dev/null | |||
@@ -1,120 +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.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public interface IEstateDataStore | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Initialise the data store. | ||
38 | /// </summary> | ||
39 | /// <param name="connectstring"></param> | ||
40 | void Initialise(string connectstring); | ||
41 | |||
42 | /// <summary> | ||
43 | /// Load estate settings for a region. | ||
44 | /// </summary> | ||
45 | /// <param name="regionID"></param> | ||
46 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
47 | /// <returns></returns> | ||
48 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Load estate settings for an estate ID. | ||
52 | /// </summary> | ||
53 | /// <param name="estateID"></param> | ||
54 | /// <returns></returns> | ||
55 | EstateSettings LoadEstateSettings(int estateID); | ||
56 | |||
57 | /// <summary> | ||
58 | /// Create a new estate. | ||
59 | /// </summary> | ||
60 | /// <returns> | ||
61 | /// A <see cref="EstateSettings"/> | ||
62 | /// </returns> | ||
63 | EstateSettings CreateNewEstate(); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Load/Get all estate settings. | ||
67 | /// </summary> | ||
68 | /// <returns>An empty list if no estates were found.</returns> | ||
69 | List<EstateSettings> LoadEstateSettingsAll(); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Store estate settings. | ||
73 | /// </summary> | ||
74 | /// <remarks> | ||
75 | /// This is also called by EstateSettings.Save()</remarks> | ||
76 | /// <param name="es"></param> | ||
77 | void StoreEstateSettings(EstateSettings es); | ||
78 | |||
79 | /// <summary> | ||
80 | /// Get estate IDs. | ||
81 | /// </summary> | ||
82 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
83 | /// <returns></returns> | ||
84 | List<int> GetEstates(string search); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Get the IDs of all estates owned by the given user. | ||
88 | /// </summary> | ||
89 | /// <returns>An empty list if no estates were found.</returns> | ||
90 | List<int> GetEstatesByOwner(UUID ownerID); | ||
91 | |||
92 | /// <summary> | ||
93 | /// Get the IDs of all estates. | ||
94 | /// </summary> | ||
95 | /// <returns>An empty list if no estates were found.</returns> | ||
96 | List<int> GetEstatesAll(); | ||
97 | |||
98 | /// <summary> | ||
99 | /// Link a region to an estate. | ||
100 | /// </summary> | ||
101 | /// <param name="regionID"></param> | ||
102 | /// <param name="estateID"></param> | ||
103 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
104 | bool LinkRegion(UUID regionID, int estateID); | ||
105 | |||
106 | /// <summary> | ||
107 | /// Get the UUIDs of all the regions in an estate. | ||
108 | /// </summary> | ||
109 | /// <param name="estateID"></param> | ||
110 | /// <returns></returns> | ||
111 | List<UUID> GetRegions(int estateID); | ||
112 | |||
113 | /// <summary> | ||
114 | /// Delete an estate | ||
115 | /// </summary> | ||
116 | /// <param name="estateID"></param> | ||
117 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
118 | bool DeleteEstate(int estateID); | ||
119 | } | ||
120 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 944c66b..461c880 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -26,6 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Services.Interfaces; | ||
29 | 31 | ||
30 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
31 | { | 33 | { |
@@ -41,6 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | uint GetRegionFlags(); | 43 | uint GetRegionFlags(); |
42 | bool IsManager(UUID avatarID); | 44 | bool IsManager(UUID avatarID); |
43 | 45 | ||
46 | string SetEstateOwner(int estateID, UserAccount account); | ||
47 | string SetEstateName(int estateID, string newName); | ||
48 | string SetRegionEstate(RegionInfo regionInfo, int estateID); | ||
49 | string CreateEstate(string estateName, UUID ownerID); | ||
50 | |||
44 | /// <summary> | 51 | /// <summary> |
45 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). | 52 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). |
46 | /// </summary> | 53 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs index f158236..7dc1552 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
30 | 31 | ||
@@ -57,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
57 | bool StartGroupChatSession(UUID agentID, UUID groupID); | 58 | bool StartGroupChatSession(UUID agentID, UUID groupID); |
58 | 59 | ||
59 | /// <summary> | 60 | /// <summary> |
60 | /// Send a message to an entire group. | 61 | /// Send a message to each member of a group whose chat session is active. |
61 | /// </summary> | 62 | /// </summary> |
62 | /// <param name="im"> | 63 | /// <param name="im"> |
63 | /// The message itself. The fields that must be populated are | 64 | /// The message itself. The fields that must be populated are |
@@ -69,5 +70,28 @@ namespace OpenSim.Region.Framework.Interfaces | |||
69 | /// </param> | 70 | /// </param> |
70 | /// <param name="groupID"></param> | 71 | /// <param name="groupID"></param> |
71 | void SendMessageToGroup(GridInstantMessage im, UUID groupID); | 72 | void SendMessageToGroup(GridInstantMessage im, UUID groupID); |
73 | |||
74 | /// <summary> | ||
75 | /// Send a message to all the members of a group that fulfill a condition. | ||
76 | /// </summary> | ||
77 | /// <param name="im"> | ||
78 | /// The message itself. The fields that must be populated are | ||
79 | /// | ||
80 | /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical) | ||
81 | /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog | ||
82 | /// message - The message itself | ||
83 | /// dialog - This must be (byte)InstantMessageDialog.SessionSend | ||
84 | /// </param> | ||
85 | /// <param name="groupID"></param> | ||
86 | /// <param name="sendingAgentForGroupCalls"> | ||
87 | /// The requesting agent to use when querying the groups service. Sometimes this is different from | ||
88 | /// im.fromAgentID, with group notices, for example. | ||
89 | /// </param> | ||
90 | /// <param name="sendCondition"> | ||
91 | /// The condition that must be met by a member for the message to be sent. If null then the message is sent | ||
92 | /// if the chat session is active. | ||
93 | /// </param> | ||
94 | void SendMessageToGroup( | ||
95 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition); | ||
72 | } | 96 | } |
73 | } \ No newline at end of file | 97 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs index eb6c5ac..2f9b222 100644 --- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | 31 | ||
@@ -41,11 +42,56 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | HTTP_PRAGMA_NO_CACHE = 6 | 42 | HTTP_PRAGMA_NO_CACHE = 6 |
42 | } | 43 | } |
43 | 44 | ||
45 | /// <summary> | ||
46 | /// The initial status of the request before it is placed on the wire. | ||
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// The request may still fail later on, in which case the normal HTTP status is set. | ||
50 | /// </remarks> | ||
51 | [Flags] | ||
52 | public enum HttpInitialRequestStatus | ||
53 | { | ||
54 | OK = 1, | ||
55 | DISALLOWED_BY_FILTER = 2 | ||
56 | } | ||
57 | |||
44 | public interface IHttpRequestModule | 58 | public interface IHttpRequestModule |
45 | { | 59 | { |
46 | UUID MakeHttpRequest(string url, string parameters, string body); | 60 | UUID MakeHttpRequest(string url, string parameters, string body); |
61 | <<<<<<< HEAD | ||
62 | |||
63 | /// <summary> | ||
64 | /// Starts the http request. | ||
65 | /// </summary> | ||
66 | /// <remarks> | ||
67 | /// This is carried out asynchronously unless it fails initial checks. Results are fetched by the script engine | ||
68 | /// HTTP requests module to be distributed back to scripts via a script event. | ||
69 | /// </remarks> | ||
70 | /// <returns>The ID of the request. If the requested could not be performed then this is UUID.Zero</returns> | ||
71 | /// <param name="localID">Local ID of the object containing the script making the request.</param> | ||
72 | /// <param name="itemID">Item ID of the script making the request.</param> | ||
73 | /// <param name="url">Url to request.</param> | ||
74 | /// <param name="parameters">LSL parameters for the request.</param> | ||
75 | /// <param name="headers">Extra headers for the request.</param> | ||
76 | /// <param name="body">Body of the request.</param> | ||
77 | /// <param name="status"> | ||
78 | /// Initial status of the request. If OK then the request is actually made to the URL. Subsequent status is | ||
79 | /// then returned via IServiceRequest when the response is asynchronously fetched. | ||
80 | /// </param> | ||
81 | UUID StartHttpRequest( | ||
82 | uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body, | ||
83 | out HttpInitialRequestStatus status); | ||
84 | |||
85 | /// <summary> | ||
86 | /// Stop and remove all http requests for the given script. | ||
87 | /// </summary> | ||
88 | /// <param name='id'></param> | ||
89 | void StopHttpRequestsForScript(UUID id); | ||
90 | |||
91 | ======= | ||
47 | UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body); | 92 | UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body); |
48 | void StopHttpRequest(uint m_localID, UUID m_itemID); | 93 | void StopHttpRequest(uint m_localID, UUID m_itemID); |
94 | >>>>>>> avn/ubitvar | ||
49 | IServiceRequest GetNextCompletedRequest(); | 95 | IServiceRequest GetNextCompletedRequest(); |
50 | void RemoveCompletedRequest(UUID id); | 96 | void RemoveCompletedRequest(UUID id); |
51 | } | 97 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 3576e35..6bad018 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -38,7 +38,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
38 | public interface IInventoryAccessModule | 38 | public interface IInventoryAccessModule |
39 | { | 39 | { |
40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); | 40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); |
41 | 41 | ||
42 | bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset); | ||
43 | |||
42 | /// <summary> | 44 | /// <summary> |
43 | /// Copy objects to a user's inventory. | 45 | /// Copy objects to a user's inventory. |
44 | /// </summary> | 46 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index ddf7565..37e20c3 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenMetaverse; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 34 | namespace OpenSim.Region.Framework.Interfaces |
34 | { | 35 | { |
@@ -41,8 +42,24 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | /// <param name="invPath">The inventory path saved</param> | 42 | /// <param name="invPath">The inventory path saved</param> |
42 | /// <param name="savePath">The stream to which the archive was saved</param> | 43 | /// <param name="savePath">The stream to which the archive was saved</param> |
43 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> | 44 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> |
45 | /// <param name="saveCount">Number of inventory items saved to archive</param> | ||
46 | /// <param name="filterCount">Number of inventory items skipped due to perm filter option</param> | ||
44 | public delegate void InventoryArchiveSaved( | 47 | public delegate void InventoryArchiveSaved( |
45 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); | 48 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int saveCount, int filterCount); |
49 | |||
50 | /// <summary> | ||
51 | /// Used for the OnInventoryArchiveLoaded event. | ||
52 | /// </summary> | ||
53 | /// <param name="id">Request id</param> | ||
54 | /// <param name="succeeded">true if the load succeeded, false otherwise</param> | ||
55 | /// <param name="userInfo">The user for whom the load was conducted</param> | ||
56 | /// <param name="invPath">The inventory path loaded</param> | ||
57 | /// <param name="savePath">The stream from which the archive was loaded</param> | ||
58 | /// <param name="reportedException">Contains the exception generated if the load did not succeed</param> | ||
59 | /// <param name="loadCount">Number of inventory items loaded from archive</param> | ||
60 | public delegate void InventoryArchiveLoaded( | ||
61 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int loadCount); | ||
62 | |||
46 | 63 | ||
47 | public interface IInventoryArchiverModule | 64 | public interface IInventoryArchiverModule |
48 | { | 65 | { |
@@ -52,6 +69,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | event InventoryArchiveSaved OnInventoryArchiveSaved; | 69 | event InventoryArchiveSaved OnInventoryArchiveSaved; |
53 | 70 | ||
54 | /// <summary> | 71 | /// <summary> |
72 | /// Fired when an archive inventory load has been completed. | ||
73 | /// </summary> | ||
74 | event InventoryArchiveLoaded OnInventoryArchiveLoaded; | ||
75 | |||
76 | /// <summary> | ||
55 | /// Dearchive a user's inventory folder from the given stream | 77 | /// Dearchive a user's inventory folder from the given stream |
56 | /// </summary> | 78 | /// </summary> |
57 | /// <param name="firstName"></param> | 79 | /// <param name="firstName"></param> |
@@ -59,7 +81,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
59 | /// <param name="invPath">The inventory path in which to place the loaded folders and items</param> | 81 | /// <param name="invPath">The inventory path in which to place the loaded folders and items</param> |
60 | /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> | 82 | /// <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> | 83 | /// <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); | 84 | bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream); |
63 | 85 | ||
64 | /// <summary> | 86 | /// <summary> |
65 | /// Dearchive a user's inventory folder from the given stream | 87 | /// Dearchive a user's inventory folder from the given stream |
@@ -72,7 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
72 | /// the loaded IAR with existing folders where possible.</param> | 94 | /// the loaded IAR with existing folders where possible.</param> |
73 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 95 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
74 | bool DearchiveInventory( | 96 | bool DearchiveInventory( |
75 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 97 | UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream, |
76 | Dictionary<string, object> options); | 98 | Dictionary<string, object> options); |
77 | 99 | ||
78 | /// <summary> | 100 | /// <summary> |
@@ -84,7 +106,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
84 | /// <param name="invPath">The inventory path from which the inventory should be saved.</param> | 106 | /// <param name="invPath">The inventory path from which the inventory should be saved.</param> |
85 | /// <param name="saveStream">The stream to which the inventory archive will be saved</param> | 107 | /// <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> | 108 | /// <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); | 109 | bool ArchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream); |
88 | 110 | ||
89 | /// <summary> | 111 | /// <summary> |
90 | /// Archive a user's inventory folder to the given stream | 112 | /// Archive a user's inventory folder to the given stream |
@@ -97,7 +119,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
97 | /// <param name="options">Archiving options. Currently, there are none.</param> | 119 | /// <param name="options">Archiving options. Currently, there are none.</param> |
98 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 120 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
99 | bool ArchiveInventory( | 121 | bool ArchiveInventory( |
100 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 122 | UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
101 | Dictionary<string, object> options); | 123 | Dictionary<string, object> options); |
102 | } | 124 | } |
103 | } | 125 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs index 46d03b3..1cbd045 100644 --- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs +++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Drawing; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenMetaverse.Imaging; | 30 | using OpenMetaverse.Imaging; |
30 | 31 | ||
@@ -53,5 +54,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
53 | /// <param name="components">number of components</param> | 54 | /// <param name="components">number of components</param> |
54 | /// <returns>true if decode was successful. false otherwise.</returns> | 55 | /// <returns>true if decode was successful. false otherwise.</returns> |
55 | bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components); | 56 | bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components); |
57 | |||
58 | /// <summary> | ||
59 | /// Provides a synchronous decode direct to an image object | ||
60 | /// </summary> | ||
61 | /// <param name="j2kData"></param> | ||
62 | /// <returns>decoded image or 'null' of unsuccessful</returns> | ||
63 | Image DecodeToImage(byte[] j2kData); | ||
56 | } | 64 | } |
57 | } | 65 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs index 5151567..eb79711 100644 --- a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs | |||
@@ -25,14 +25,24 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | <<<<<<< HEAD | ||
29 | using System.Drawing; | ||
30 | using OpenSim.Framework; | ||
31 | ======= | ||
28 | using OpenMetaverse; | 32 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
30 | using System.Drawing; | 34 | using System.Drawing; |
35 | >>>>>>> avn/ubitvar | ||
31 | 36 | ||
32 | namespace OpenSim.Region.Framework.Interfaces | 37 | namespace OpenSim.Region.Framework.Interfaces |
33 | { | 38 | { |
34 | public interface IMapImageUploadModule | 39 | public interface IMapImageUploadModule |
35 | { | 40 | { |
41 | <<<<<<< HEAD | ||
42 | void UploadMapTile(IScene scene, Bitmap mapTile); | ||
43 | } | ||
44 | } | ||
45 | ======= | ||
36 | /// <summary> | 46 | /// <summary> |
37 | /// Upload a new maptile | 47 | /// Upload a new maptile |
38 | /// </summary> | 48 | /// </summary> |
@@ -40,3 +50,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
40 | void UploadMapTile(IScene scene, Bitmap mapTile); | 50 | void UploadMapTile(IScene scene, Bitmap mapTile); |
41 | } | 51 | } |
42 | } | 52 | } |
53 | >>>>>>> avn/ubitvar | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs index b0b47a7..290b826 100644 --- a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs | |||
@@ -36,6 +36,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
36 | { | 36 | { |
37 | event UndeliveredMessage OnUndeliveredMessage; | 37 | event UndeliveredMessage OnUndeliveredMessage; |
38 | 38 | ||
39 | /// <summary> | ||
40 | /// Attempt to send an instant message to a given destination. | ||
41 | /// </summary> | ||
42 | /// <remarks> | ||
43 | /// If the message cannot be delivered for any reason, this will be signalled on the OnUndeliveredMessage | ||
44 | /// event. result(false) will also be called if the message cannot be delievered unless the type is | ||
45 | /// InstantMessageDialog.MessageFromAgent. For successful message delivery, result(true) is called. | ||
46 | /// </remarks> | ||
47 | /// <param name="im"></param> | ||
48 | /// <param name="result"></param> | ||
39 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); | 49 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); |
50 | |||
51 | /// <summary> | ||
52 | /// Appropriately handle a known undeliverable message without attempting a send. | ||
53 | /// </summary> | ||
54 | /// <remarks> | ||
55 | /// Essentially, this invokes the OnUndeliveredMessage event. | ||
56 | /// </remarks> | ||
57 | /// <param name="im"></param> | ||
58 | /// <param name="result"></param> | ||
59 | void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result); | ||
40 | } | 60 | } |
41 | } | 61 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 9817cf7..478833e 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -72,6 +72,32 @@ namespace OpenSim.Region.Framework.Interfaces | |||
72 | AvatarAppearance appearance); | 72 | AvatarAppearance appearance); |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Create an NPC with a user-supplied agentID | ||
76 | /// </summary> | ||
77 | /// <param name="firstname"></param> | ||
78 | /// <param name="lastname"></param> | ||
79 | /// <param name="position"></param> | ||
80 | /// <param name="agentID"></param> | ||
81 | /// The desired agent ID | ||
82 | /// <param name="owner"></param> | ||
83 | /// <param name="senseAsAgent"> | ||
84 | /// Make the NPC show up as an agent on LSL sensors. The default is | ||
85 | /// that they show up as the NPC type instead, but this is currently | ||
86 | /// an OpenSim-only extension. | ||
87 | /// </param> | ||
88 | /// <param name="scene"></param> | ||
89 | /// <param name="appearance"> | ||
90 | /// The avatar appearance to use for the new NPC. | ||
91 | /// </param> | ||
92 | /// <returns> | ||
93 | /// The UUID of the ScenePresence created. UUID.Zero if there was a | ||
94 | /// failure. | ||
95 | /// </returns> | ||
96 | UUID CreateNPC(string firstname, string lastname, | ||
97 | Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, | ||
98 | AvatarAppearance appearance); | ||
99 | |||
100 | /// <summary> | ||
75 | /// Check if the agent is an NPC. | 101 | /// Check if the agent is an NPC. |
76 | /// </summary> | 102 | /// </summary> |
77 | /// <param name="agentID"></param> | 103 | /// <param name="agentID"></param> |
@@ -96,6 +122,17 @@ namespace OpenSim.Region.Framework.Interfaces | |||
96 | /// <summary> | 122 | /// <summary> |
97 | /// Check if the caller has permission to manipulate the given NPC. | 123 | /// Check if the caller has permission to manipulate the given NPC. |
98 | /// </summary> | 124 | /// </summary> |
125 | /// <remarks> | ||
126 | /// A caller has permission if | ||
127 | /// * An NPC exists with the given npcID. | ||
128 | /// * The caller UUID given is UUID.Zero. | ||
129 | /// * The avatar is unowned (owner is UUID.Zero). | ||
130 | /// * The avatar is owned and the owner and callerID match. | ||
131 | /// * The avatar is owned and the callerID matches its agentID. | ||
132 | /// </remarks> | ||
133 | /// <param name="av"></param> | ||
134 | /// <param name="callerID"></param> | ||
135 | /// <returns>true if they do, false if they don't.</returns> | ||
99 | /// <param name="npcID"></param> | 136 | /// <param name="npcID"></param> |
100 | /// <param name="callerID"></param> | 137 | /// <param name="callerID"></param> |
101 | /// <returns> | 138 | /// <returns> |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index ed93916..445342d 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs | |||
@@ -127,7 +127,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
127 | /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> | 127 | /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> |
128 | /// <param name="options"> | 128 | /// <param name="options"> |
129 | /// Dictionary of options. | 129 | /// Dictionary of options. |
130 | <<<<<<< HEAD | ||
131 | /// </param> | ||
132 | void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string,object> options); | ||
133 | ======= | ||
130 | /// </param> | 134 | /// </param> |
131 | void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options); | 135 | void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options); |
136 | >>>>>>> avn/ubitvar | ||
132 | } | 137 | } |
133 | } | 138 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs b/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs index 9b1e4ca..2089bce 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs | |||
@@ -32,6 +32,7 @@ using OpenSim.Region.Framework.Scenes; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 33 | namespace OpenSim.Region.Framework.Interfaces |
34 | { | 34 | { |
35 | [TypeExtensionPoint(Path = "/OpenSim/RegionModules", NodeName="RegionModule")] | ||
35 | public interface IRegionModuleBase | 36 | public interface IRegionModuleBase |
36 | { | 37 | { |
37 | /// <value> | 38 | /// <value> |
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 595e031..ff18519 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs | |||
@@ -24,10 +24,15 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System.IO; | ||
27 | 28 | ||
29 | using OpenSim.Framework; | ||
28 | 30 | ||
31 | <<<<<<< HEAD | ||
32 | ======= | ||
29 | using System.IO; | 33 | using System.IO; |
30 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | >>>>>>> avn/ubitvar | ||
31 | using OpenMetaverse; | 36 | using OpenMetaverse; |
32 | 37 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 38 | namespace OpenSim.Region.Framework.Interfaces |
@@ -51,6 +56,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
51 | void PushTerrain(IClientAPI pClient); | 56 | void PushTerrain(IClientAPI pClient); |
52 | 57 | ||
53 | /// <summary> | 58 | /// <summary> |
59 | /// When a client initially connects, all the terrain must be pushed to the viewer. | ||
60 | /// This call causes all the terrain patches to be sent to the client. | ||
61 | /// </summary> | ||
62 | void PushTerrain(IClientAPI pClient); | ||
63 | |||
64 | /// <summary> | ||
54 | /// Load a terrain from a stream. | 65 | /// Load a terrain from a stream. |
55 | /// </summary> | 66 | /// </summary> |
56 | /// <param name="filename"> | 67 | /// <param name="filename"> |
@@ -58,6 +69,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
58 | /// </param> | 69 | /// </param> |
59 | /// <param name="stream"></param> | 70 | /// <param name="stream"></param> |
60 | void LoadFromStream(string filename, Stream stream); | 71 | void LoadFromStream(string filename, Stream stream); |
72 | void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream); | ||
61 | void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); | 73 | void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); |
62 | void LoadFromStream(string filename, Vector3 displacement, | 74 | void LoadFromStream(string filename, Vector3 displacement, |
63 | float radianRotation, Vector2 rotationDisplacement, Stream stream); | 75 | float radianRotation, Vector2 rotationDisplacement, Stream stream); |
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs deleted file mode 100644 index f8088c3..0000000 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.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.Collections.Generic; | ||
30 | |||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// This maintains the relationship between a UUID and a user name. | ||
37 | /// </summary> | ||
38 | public interface IUserManagement | ||
39 | { | ||
40 | string GetUserName(UUID uuid); | ||
41 | string GetUserHomeURL(UUID uuid); | ||
42 | string GetUserUUI(UUID uuid); | ||
43 | string GetUserServerURL(UUID uuid, string serverType); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Get user ID by the given name. | ||
47 | /// </summary> | ||
48 | /// <param name="name"></param> | ||
49 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
50 | UUID GetUserIdByName(string name); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Get user ID by the given name. | ||
54 | /// </summary> | ||
55 | /// <param name="firstName"></param> | ||
56 | /// <param name="lastName"></param> | ||
57 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
58 | UUID GetUserIdByName(string firstName, string lastName); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Add a user. | ||
62 | /// </summary> | ||
63 | /// <remarks> | ||
64 | /// If an account is found for the UUID, then the names in this will be used rather than any information | ||
65 | /// extracted from creatorData. | ||
66 | /// </remarks> | ||
67 | /// <param name="uuid"></param> | ||
68 | /// <param name="creatorData">The creator data for this user.</param> | ||
69 | void AddUser(UUID uuid, string creatorData); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Add a user. | ||
73 | /// </summary> | ||
74 | /// <remarks> | ||
75 | /// The UUID is related to the name without any other checks being performed, such as user account presence. | ||
76 | /// </remarks> | ||
77 | /// <param name="uuid"></param> | ||
78 | /// <param name="firstName"></param> | ||
79 | /// <param name="lastName"></param> | ||
80 | void AddUser(UUID uuid, string firstName, string lastName); | ||
81 | |||
82 | /// <summary> | ||
83 | /// Add a user. | ||
84 | /// </summary> | ||
85 | /// <remarks> | ||
86 | /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the | ||
87 | /// AddUser(UUID uuid, string creatorData) method. | ||
88 | /// </remarks> | ||
89 | /// <param name="uuid"></param> | ||
90 | /// <param name="firstName"></param> | ||
91 | /// <param name="profileURL"></param> | ||
92 | void AddUser(UUID uuid, string firstName, string lastName, string homeURL); | ||
93 | |||
94 | bool IsLocalGridUser(UUID uuid); | ||
95 | } | ||
96 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs index b087c8b..16b6024 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs | |||
@@ -33,8 +33,11 @@ using OpenSim.Framework; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | using Mono.Addins; | ||
37 | |||
36 | namespace OpenSim.Region.Framework.Interfaces | 38 | namespace OpenSim.Region.Framework.Interfaces |
37 | { | 39 | { |
40 | [TypeExtensionPoint(Path = "/OpenSim/WindModule", NodeName = "WindModel")] | ||
38 | public interface IWindModelPlugin : IPlugin | 41 | public interface IWindModelPlugin : IPlugin |
39 | { | 42 | { |
40 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index e9cf4ad..08dc3e3 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | |||
@@ -37,6 +37,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
37 | /// </summary> | 37 | /// </summary> |
38 | void GenerateMaptile(); | 38 | void GenerateMaptile(); |
39 | List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); | 39 | List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); |
40 | <<<<<<< HEAD | ||
41 | MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag); | ||
42 | ======= | ||
40 | void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); | 43 | void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); |
44 | >>>>>>> avn/ubitvar | ||
41 | } | 45 | } |
42 | } | 46 | } |
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs index a2a99d4..97dea1f 100644 --- a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs | |||
@@ -1,6 +1,7 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | using Mono.Addins; | ||
4 | 5 | ||
5 | // General Information about an assembly is controlled through the following | 6 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 7 | // set of attributes. Change these attribute values to modify the information |
@@ -22,6 +23,7 @@ using System.Runtime.InteropServices; | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("d25e7aed-7f55-4bb8-9970-0d7d978ea8a5")] | 24 | [assembly: Guid("d25e7aed-7f55-4bb8-9970-0d7d978ea8a5")] |
24 | 25 | ||
26 | |||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
27 | // Major Version | 29 | // Major Version |
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 31 | // Build Number |
30 | // Revision | 32 | // Revision |
31 | // | 33 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 34 | [assembly: AssemblyVersion("0.8.2.*")] |
35 | [assembly: AddinRoot("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] | ||
33 | 36 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index b7400ea..eb1a970 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | |||
@@ -306,6 +306,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
306 | return base.Equals(obj); | 306 | return base.Equals(obj); |
307 | } | 307 | } |
308 | 308 | ||
309 | public override int GetHashCode() | ||
310 | { | ||
311 | return base.GetHashCode(); | ||
312 | } | ||
313 | |||
309 | public override string ToString() | 314 | public override string ToString() |
310 | { | 315 | { |
311 | StringBuilder buff = new StringBuilder(); | 316 | StringBuilder buff = new StringBuilder(); |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs index 3afc87f..b3b38b2 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -113,31 +113,34 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
113 | 113 | ||
114 | public byte[] ToBytes() | 114 | public byte[] ToBytes() |
115 | { | 115 | { |
116 | byte[] outputbytes = new byte[0]; | 116 | byte[] outputbytes; |
117 | 117 | ||
118 | BinaryWriter iostream = new BinaryWriter(new MemoryStream()); | 118 | using (MemoryStream ms = new MemoryStream()) |
119 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0))); | 119 | using (BinaryWriter iostream = new BinaryWriter(ms)) |
120 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1))); | ||
121 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority))); | ||
122 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length))); | ||
123 | iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName)); | ||
124 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint))); | ||
125 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint))); | ||
126 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0))); | ||
127 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime))); | ||
128 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime))); | ||
129 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose))); | ||
130 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length)))); | ||
131 | |||
132 | for (int i = 0; i < Joints.Length; i++) | ||
133 | { | 120 | { |
134 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); | 121 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0))); |
122 | iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1))); | ||
123 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority))); | ||
124 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length))); | ||
125 | iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName)); | ||
126 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint))); | ||
127 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint))); | ||
128 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0))); | ||
129 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime))); | ||
130 | iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime))); | ||
131 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose))); | ||
132 | iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length)))); | ||
133 | |||
134 | for (int i = 0; i < Joints.Length; i++) | ||
135 | { | ||
136 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); | ||
137 | } | ||
138 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); | ||
139 | |||
140 | using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream) | ||
141 | outputbytes = ms2.ToArray(); | ||
135 | } | 142 | } |
136 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); | 143 | |
137 | MemoryStream ms = (MemoryStream)iostream.BaseStream; | ||
138 | outputbytes = ms.ToArray(); | ||
139 | ms.Close(); | ||
140 | iostream.Close(); | ||
141 | return outputbytes; | 144 | return outputbytes; |
142 | } | 145 | } |
143 | 146 | ||
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 24fbef9..22b8e4d 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -433,6 +433,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
433 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 433 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
434 | public event IncomingInstantMessage OnIncomingInstantMessage; | 434 | public event IncomingInstantMessage OnIncomingInstantMessage; |
435 | 435 | ||
436 | public delegate void CrossAgentToNewRegion(ScenePresence sp, bool isFlying, GridRegion newRegion); | ||
437 | public event CrossAgentToNewRegion OnCrossAgentToNewRegion; | ||
438 | |||
436 | public event IncomingInstantMessage OnUnhandledInstantMessage; | 439 | public event IncomingInstantMessage OnUnhandledInstantMessage; |
437 | 440 | ||
438 | public delegate void ClientClosed(UUID clientID, Scene scene); | 441 | public delegate void ClientClosed(UUID clientID, Scene scene); |
@@ -786,8 +789,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
786 | /// <see cref="Scene.doObjectDuplicateOnRay"/> | 789 | /// <see cref="Scene.doObjectDuplicateOnRay"/> |
787 | /// </remarks> | 790 | /// </remarks> |
788 | public event Action<SceneObjectGroup> OnObjectAddedToScene; | 791 | public event Action<SceneObjectGroup> OnObjectAddedToScene; |
792 | |||
793 | /// <summary> | ||
794 | /// When a client sends a derez request for an object inworld | ||
795 | /// but before the object is deleted | ||
796 | /// </summary> | ||
797 | public event DeRezRequested OnDeRezRequested; | ||
798 | /// <summary> | ||
799 | /// Triggered when a client sends a derez request for an object inworld | ||
800 | /// </summary> | ||
801 | /// <param name="remoteClient">The client question (it can be null)</param> | ||
802 | /// <param name="obj">The object in question</param> | ||
803 | /// <param name="action">The exact derez action</param> | ||
804 | /// <returns>Flag indicating whether the object should be deleted from the scene or not</returns> | ||
805 | public delegate bool DeRezRequested(IClientAPI remoteClient, List<SceneObjectGroup> objs, DeRezAction action); | ||
789 | 806 | ||
790 | /// <summary> | 807 | /// <summary> |
808 | /// Triggered when an object is removed from the scene. | ||
809 | /// </summary> | ||
810 | /// <remarks> | ||
811 | /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/> | ||
812 | /// in <see cref="Scene.DeleteSceneObject"/> | ||
813 | /// </remarks> | ||
814 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | ||
815 | /// <summary> | ||
791 | /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> | 816 | /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> |
792 | /// </summary> | 817 | /// </summary> |
793 | /// <param name="obj">The object being removed from the scene</param> | 818 | /// <param name="obj">The object being removed from the scene</param> |
@@ -806,15 +831,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
806 | /// </remarks> | 831 | /// </remarks> |
807 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | 832 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; |
808 | 833 | ||
809 | /// <summary> | ||
810 | /// Triggered when an object is removed from the scene. | ||
811 | /// </summary> | ||
812 | /// <remarks> | ||
813 | /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/> | ||
814 | /// in <see cref="Scene.DeleteSceneObject"/> | ||
815 | /// </remarks> | ||
816 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | ||
817 | |||
818 | public delegate void NoticeNoLandDataFromStorage(); | 834 | public delegate void NoticeNoLandDataFromStorage(); |
819 | public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage; | 835 | public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage; |
820 | 836 | ||
@@ -1568,8 +1584,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1568 | } | 1584 | } |
1569 | } | 1585 | } |
1570 | } | 1586 | } |
1571 | } | 1587 | } |
1572 | 1588 | ||
1589 | public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action) | ||
1590 | { | ||
1591 | bool canDeRez = true; | ||
1592 | |||
1593 | DeRezRequested handlerDeRezRequested = OnDeRezRequested; | ||
1594 | if (handlerDeRezRequested != null) | ||
1595 | { | ||
1596 | foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList()) | ||
1597 | { | ||
1598 | try | ||
1599 | { | ||
1600 | canDeRez &= d(client, objs, action); | ||
1601 | } | ||
1602 | catch (Exception e) | ||
1603 | { | ||
1604 | m_log.ErrorFormat( | ||
1605 | "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}", | ||
1606 | e.Message, e.StackTrace); | ||
1607 | } | ||
1608 | } | ||
1609 | } | ||
1610 | |||
1611 | return canDeRez; | ||
1612 | } | ||
1613 | |||
1573 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 1614 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
1574 | { | 1615 | { |
1575 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 1616 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
@@ -2011,6 +2052,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | } | 2052 | } |
2012 | } | 2053 | } |
2013 | 2054 | ||
2055 | public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying, GridRegion newRegion) | ||
2056 | { | ||
2057 | CrossAgentToNewRegion handlerCrossAgentToNewRegion = OnCrossAgentToNewRegion; | ||
2058 | if (handlerCrossAgentToNewRegion != null) | ||
2059 | { | ||
2060 | foreach (CrossAgentToNewRegion d in handlerCrossAgentToNewRegion.GetInvocationList()) | ||
2061 | { | ||
2062 | try | ||
2063 | { | ||
2064 | d(agent, isFlying, newRegion); | ||
2065 | } | ||
2066 | catch (Exception e) | ||
2067 | { | ||
2068 | m_log.ErrorFormat( | ||
2069 | "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}", | ||
2070 | e.Message, e.StackTrace); | ||
2071 | } | ||
2072 | } | ||
2073 | } | ||
2074 | } | ||
2075 | |||
2014 | public void TriggerIncomingInstantMessage(GridInstantMessage message) | 2076 | public void TriggerIncomingInstantMessage(GridInstantMessage message) |
2015 | { | 2077 | { |
2016 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; | 2078 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; |
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index e3f979f..2b95a4c 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | { | 47 | { |
48 | public class KeyframeTimer | 48 | public class KeyframeTimer |
49 | { | 49 | { |
50 | private static Dictionary<Scene, KeyframeTimer>m_timers = | 50 | private static Dictionary<Scene, KeyframeTimer> m_timers = |
51 | new Dictionary<Scene, KeyframeTimer>(); | 51 | new Dictionary<Scene, KeyframeTimer>(); |
52 | 52 | ||
53 | private Timer m_timer; | 53 | private Timer m_timer; |
@@ -67,8 +67,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | m_timer.Interval = TickDuration; | 67 | m_timer.Interval = TickDuration; |
68 | m_timer.AutoReset = true; | 68 | m_timer.AutoReset = true; |
69 | m_timer.Elapsed += OnTimer; | 69 | m_timer.Elapsed += OnTimer; |
70 | } | ||
70 | 71 | ||
71 | m_timer.Start(); | 72 | public void Start() |
73 | { | ||
74 | lock (m_timer) | ||
75 | { | ||
76 | if (!m_timer.Enabled) | ||
77 | m_timer.Start(); | ||
78 | } | ||
72 | } | 79 | } |
73 | 80 | ||
74 | private void OnTimer(object sender, ElapsedEventArgs ea) | 81 | private void OnTimer(object sender, ElapsedEventArgs ea) |
@@ -120,6 +127,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | { | 127 | { |
121 | timer = new KeyframeTimer(motion.Scene); | 128 | timer = new KeyframeTimer(motion.Scene); |
122 | m_timers[motion.Scene] = timer; | 129 | m_timers[motion.Scene] = timer; |
130 | |||
131 | if (!SceneManager.Instance.AllRegionsReady) | ||
132 | { | ||
133 | // Start the timers only once all the regions are ready. This is required | ||
134 | // when using megaregions, because the megaregion is correctly configured | ||
135 | // only after all the regions have been loaded. (If we don't do this then | ||
136 | // when the prim moves it might think that it crossed into a region.) | ||
137 | SceneManager.Instance.OnRegionsReadyStatusChange += delegate(SceneManager sm) | ||
138 | { | ||
139 | if (sm.AllRegionsReady) | ||
140 | timer.Start(); | ||
141 | }; | ||
142 | } | ||
143 | |||
144 | // Check again, in case the regions were started while we were adding the event handler | ||
145 | if (SceneManager.Instance.AllRegionsReady) | ||
146 | { | ||
147 | timer.Start(); | ||
148 | } | ||
123 | } | 149 | } |
124 | } | 150 | } |
125 | 151 | ||
@@ -154,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
154 | [Serializable] | 180 | [Serializable] |
155 | public class KeyframeMotion | 181 | public class KeyframeMotion |
156 | { | 182 | { |
157 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 183 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
158 | 184 | ||
159 | public enum PlayMode : int | 185 | public enum PlayMode : int |
160 | { | 186 | { |
@@ -180,6 +206,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
180 | public int TimeMS; | 206 | public int TimeMS; |
181 | public int TimeTotal; | 207 | public int TimeTotal; |
182 | public Vector3 AngularVelocity; | 208 | public Vector3 AngularVelocity; |
209 | public Vector3 StartPosition; | ||
183 | }; | 210 | }; |
184 | 211 | ||
185 | private Vector3 m_serializedPosition; | 212 | private Vector3 m_serializedPosition; |
@@ -284,10 +311,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
284 | 311 | ||
285 | try | 312 | try |
286 | { | 313 | { |
287 | MemoryStream ms = new MemoryStream(data); | 314 | using (MemoryStream ms = new MemoryStream(data)) |
288 | BinaryFormatter fmt = new BinaryFormatter(); | 315 | { |
289 | 316 | BinaryFormatter fmt = new BinaryFormatter(); | |
290 | newMotion = (KeyframeMotion)fmt.Deserialize(ms); | 317 | newMotion = (KeyframeMotion)fmt.Deserialize(ms); |
318 | } | ||
291 | 319 | ||
292 | newMotion.m_group = grp; | 320 | newMotion.m_group = grp; |
293 | 321 | ||
@@ -323,6 +351,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
323 | m_group = grp; | 351 | m_group = grp; |
324 | m_scene = grp.Scene; | 352 | m_scene = grp.Scene; |
325 | 353 | ||
354 | <<<<<<< HEAD | ||
355 | Vector3 grppos = grp.AbsolutePosition; | ||
356 | Vector3 offset = grppos - m_serializedPosition; | ||
357 | // avoid doing it more than once | ||
358 | // current this will happen dragging a prim to other region | ||
359 | m_serializedPosition = grppos; | ||
360 | |||
361 | m_basePosition += offset; | ||
362 | m_nextPosition += offset; | ||
363 | |||
364 | m_currentFrame.StartPosition += offset; | ||
365 | m_currentFrame.Position += offset; | ||
366 | |||
367 | for (int i = 0; i < m_frames.Count; i++) | ||
368 | { | ||
369 | Keyframe k = m_frames[i]; | ||
370 | k.StartPosition += offset; | ||
371 | k.Position += offset; | ||
372 | m_frames[i]=k; | ||
373 | ======= | ||
326 | lock (m_frames) | 374 | lock (m_frames) |
327 | { | 375 | { |
328 | Vector3 grppos = grp.AbsolutePosition; | 376 | Vector3 grppos = grp.AbsolutePosition; |
@@ -342,6 +390,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
342 | k.Position += offset; | 390 | k.Position += offset; |
343 | m_frames[i] = k; | 391 | m_frames[i] = k; |
344 | } | 392 | } |
393 | >>>>>>> avn/ubitvar | ||
345 | } | 394 | } |
346 | 395 | ||
347 | if (m_running) | 396 | if (m_running) |
@@ -433,6 +482,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
433 | { | 482 | { |
434 | StartTimer(); | 483 | StartTimer(); |
435 | m_running = true; | 484 | m_running = true; |
485 | m_group.Scene.EventManager.TriggerMovingStartEvent(m_group.RootPart.LocalId); | ||
436 | } | 486 | } |
437 | else | 487 | else |
438 | { | 488 | { |
@@ -515,6 +565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
515 | { | 565 | { |
516 | Keyframe k = m_keyframes[i]; | 566 | Keyframe k = m_keyframes[i]; |
517 | 567 | ||
568 | k.StartPosition = pos; | ||
518 | if (k.Position.HasValue) | 569 | if (k.Position.HasValue) |
519 | { | 570 | { |
520 | k.Position = (k.Position * direction); | 571 | k.Position = (k.Position * direction); |
@@ -657,6 +708,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
657 | 708 | ||
658 | if (m_frames.Count == 0) | 709 | if (m_frames.Count == 0) |
659 | { | 710 | { |
711 | <<<<<<< HEAD | ||
712 | if (!m_running) return; | ||
713 | |||
714 | GetNextList(); | ||
715 | |||
716 | if (m_frames.Count == 0) | ||
717 | { | ||
718 | Stop(); | ||
719 | // Scene scene = m_group.Scene; | ||
720 | // | ||
721 | // IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>(); | ||
722 | // foreach (IScriptModule m in scriptModules) | ||
723 | // { | ||
724 | // if (m == null) | ||
725 | // continue; | ||
726 | // m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); | ||
727 | // } | ||
728 | |||
729 | m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); | ||
730 | |||
731 | return; | ||
732 | } | ||
733 | ======= | ||
660 | lock (m_frames) | 734 | lock (m_frames) |
661 | { | 735 | { |
662 | GetNextList(); | 736 | GetNextList(); |
@@ -673,6 +747,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | continue; | 747 | continue; |
674 | m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); | 748 | m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); |
675 | } | 749 | } |
750 | >>>>>>> avn/ubitvar | ||
676 | 751 | ||
677 | return; | 752 | return; |
678 | } | 753 | } |
@@ -688,9 +763,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
688 | m_currentFrame.TimeMS -= (int)tickDuration; | 763 | m_currentFrame.TimeMS -= (int)tickDuration; |
689 | 764 | ||
690 | // Do the frame processing | 765 | // Do the frame processing |
691 | double steps = (double)m_currentFrame.TimeMS / tickDuration; | 766 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; |
692 | 767 | ||
693 | if (steps <= 0.0) | 768 | if (remainingSteps <= 0.0) |
694 | { | 769 | { |
695 | m_group.RootPart.Velocity = Vector3.Zero; | 770 | m_group.RootPart.Velocity = Vector3.Zero; |
696 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 771 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
@@ -714,23 +789,75 @@ namespace OpenSim.Region.Framework.Scenes | |||
714 | } | 789 | } |
715 | else | 790 | else |
716 | { | 791 | { |
717 | float complete = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; | 792 | float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; |
793 | bool lastStep = m_currentFrame.TimeMS <= tickDuration; | ||
794 | |||
795 | Vector3 positionThisStep = m_currentFrame.StartPosition + (m_currentFrame.Position.Value - m_currentFrame.StartPosition) * completed; | ||
796 | Vector3 motionThisStep = positionThisStep - m_group.AbsolutePosition; | ||
718 | 797 | ||
719 | Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition; | 798 | <<<<<<< HEAD |
720 | Vector3 motionThisFrame = v / (float)steps; | 799 | float mag = Vector3.Mag(motionThisStep); |
721 | v = v * 1000 / m_currentFrame.TimeMS; | ||
722 | 800 | ||
801 | if ((mag >= 0.02f) || lastStep) | ||
802 | { | ||
803 | m_nextPosition = m_group.AbsolutePosition + motionThisStep; | ||
804 | m_group.AbsolutePosition = m_nextPosition; | ||
805 | ======= | ||
723 | m_nextPosition = m_group.AbsolutePosition + motionThisFrame; | 806 | m_nextPosition = m_group.AbsolutePosition + motionThisFrame; |
724 | 807 | ||
725 | if (Vector3.Mag(motionThisFrame) >= 0.05f) | 808 | if (Vector3.Mag(motionThisFrame) >= 0.05f) |
809 | >>>>>>> avn/ubitvar | ||
726 | update = true; | 810 | update = true; |
727 | 811 | ||
812 | //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration; | ||
813 | //m_log.DebugFormat("KeyframeMotion.OnTimer: step {0}/{1}, curPosition={2}, finalPosition={3}, motionThisStep={4} (scene {5})", | ||
814 | // totalSteps - remainingSteps + 1, totalSteps, m_group.AbsolutePosition, m_currentFrame.Position, motionThisStep, m_scene.RegionInfo.RegionName); | ||
815 | |||
728 | if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation) | 816 | if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation) |
729 | { | 817 | { |
730 | Quaternion current = m_group.GroupRotation; | 818 | Quaternion current = m_group.GroupRotation; |
731 | 819 | ||
732 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, complete); | 820 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); |
733 | step.Normalize(); | 821 | step.Normalize(); |
822 | <<<<<<< HEAD | ||
823 | /* use simpler change detection | ||
824 | * float angle = 0; | ||
825 | |||
826 | float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W; | ||
827 | float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W; | ||
828 | float aa_bb = aa * bb; | ||
829 | |||
830 | if (aa_bb == 0) | ||
831 | { | ||
832 | angle = 0; | ||
833 | } | ||
834 | else | ||
835 | { | ||
836 | float ab = current.X * step.X + | ||
837 | current.Y * step.Y + | ||
838 | current.Z * step.Z + | ||
839 | current.W * step.W; | ||
840 | float q = (ab * ab) / aa_bb; | ||
841 | |||
842 | if (q > 1.0f) | ||
843 | { | ||
844 | angle = 0; | ||
845 | } | ||
846 | else | ||
847 | { | ||
848 | angle = (float)Math.Acos(2 * q - 1); | ||
849 | } | ||
850 | } | ||
851 | |||
852 | if (angle > 0.01f) | ||
853 | */ | ||
854 | if(Math.Abs(step.X - current.X) > 0.001f | ||
855 | || Math.Abs(step.Y - current.Y) > 0.001f | ||
856 | || Math.Abs(step.Z - current.Z) > 0.001f | ||
857 | || lastStep) | ||
858 | // assuming w is a dependente var | ||
859 | |||
860 | ======= | ||
734 | /* use simpler change detection | 861 | /* use simpler change detection |
735 | * float angle = 0; | 862 | * float angle = 0; |
736 | 863 | ||
@@ -766,6 +893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
766 | || Math.Abs(step.Y - current.Y) > 0.001f | 893 | || Math.Abs(step.Y - current.Y) > 0.001f |
767 | || Math.Abs(step.Z - current.Z) > 0.001f) | 894 | || Math.Abs(step.Z - current.Z) > 0.001f) |
768 | // assuming w is a dependente var | 895 | // assuming w is a dependente var |
896 | >>>>>>> avn/ubitvar | ||
769 | { | 897 | { |
770 | // m_group.UpdateGroupRotationR(step); | 898 | // m_group.UpdateGroupRotationR(step); |
771 | m_group.RootPart.RotationOffset = step; | 899 | m_group.RootPart.RotationOffset = step; |
@@ -791,19 +919,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
791 | timerWasStopped = m_timerStopped; | 919 | timerWasStopped = m_timerStopped; |
792 | } | 920 | } |
793 | StopTimer(); | 921 | StopTimer(); |
794 | MemoryStream ms = new MemoryStream(); | ||
795 | 922 | ||
796 | BinaryFormatter fmt = new BinaryFormatter(); | ||
797 | SceneObjectGroup tmp = m_group; | 923 | SceneObjectGroup tmp = m_group; |
798 | m_group = null; | 924 | m_group = null; |
799 | if (!m_selected && tmp != null) | 925 | if (!m_selected && tmp != null) |
800 | m_serializedPosition = tmp.AbsolutePosition; | 926 | m_serializedPosition = tmp.AbsolutePosition; |
927 | <<<<<<< HEAD | ||
928 | ======= | ||
801 | fmt.Serialize(ms, this); | 929 | fmt.Serialize(ms, this); |
802 | m_group = tmp; | 930 | m_group = tmp; |
803 | if (!timerWasStopped && m_running && !m_waitingCrossing) | 931 | if (!timerWasStopped && m_running && !m_waitingCrossing) |
804 | StartTimer(); | 932 | StartTimer(); |
933 | >>>>>>> avn/ubitvar | ||
805 | 934 | ||
806 | return ms.ToArray(); | 935 | using (MemoryStream ms = new MemoryStream()) |
936 | { | ||
937 | BinaryFormatter fmt = new BinaryFormatter(); | ||
938 | fmt.Serialize(ms, this); | ||
939 | m_group = tmp; | ||
940 | if (m_running && !m_waitingCrossing) | ||
941 | StartTimer(); | ||
942 | |||
943 | return ms.ToArray(); | ||
944 | } | ||
807 | } | 945 | } |
808 | 946 | ||
809 | public void StartCrossingCheck() | 947 | public void StartCrossingCheck() |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4ab5a4a..e289666 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -30,24 +30,27 @@ using System.Collections.Generic; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
33 | using System.Timers; | 34 | using System.Timers; |
34 | using System.Xml; | 35 | using System.Xml; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
36 | using OpenMetaverse.Packets; | 37 | using OpenMetaverse.Packets; |
37 | using log4net; | 38 | using log4net; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Region.Framework; | 41 | using OpenSim.Region.Framework; |
40 | using OpenSim.Framework.Client; | 42 | using OpenSim.Framework.Client; |
41 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | 44 | using OpenSim.Region.Framework.Scenes.Serialization; |
45 | using OpenSim.Services.Interfaces; | ||
43 | using PermissionMask = OpenSim.Framework.PermissionMask; | 46 | using PermissionMask = OpenSim.Framework.PermissionMask; |
44 | 47 | ||
45 | namespace OpenSim.Region.Framework.Scenes | 48 | namespace OpenSim.Region.Framework.Scenes |
46 | { | 49 | { |
47 | public partial class Scene | 50 | public partial class Scene |
48 | { | 51 | { |
49 | private static readonly ILog m_log | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | //private static readonly string LogHeader = "[SCENE INVENTORY]"; |
51 | 54 | ||
52 | /// <summary> | 55 | /// <summary> |
53 | /// Allows asynchronous derezzing of objects from the scene into a client's inventory. | 56 | /// Allows asynchronous derezzing of objects from the scene into a client's inventory. |
@@ -127,11 +130,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
127 | } | 130 | } |
128 | } | 131 | } |
129 | 132 | ||
133 | public bool AddInventoryItem(InventoryItemBase item) | ||
134 | { | ||
135 | return AddInventoryItem(item, true); | ||
136 | } | ||
137 | |||
130 | /// <summary> | 138 | /// <summary> |
131 | /// Add the given inventory item to a user's inventory. | 139 | /// Add the given inventory item to a user's inventory. |
132 | /// </summary> | 140 | /// </summary> |
133 | /// <param name="item"></param> | 141 | /// <param name="item"></param> |
134 | public bool AddInventoryItem(InventoryItemBase item) | 142 | public bool AddInventoryItem(InventoryItemBase item, bool trigger) |
135 | { | 143 | { |
136 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) | 144 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) |
137 | { | 145 | { |
@@ -140,14 +148,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | { | 148 | { |
141 | userlevel = 1; | 149 | userlevel = 1; |
142 | } | 150 | } |
143 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 151 | if (trigger) |
152 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
144 | 153 | ||
145 | return true; | 154 | return true; |
146 | } | 155 | } |
147 | 156 | ||
148 | // OK so either the viewer didn't send a folderID or AddItem failed | 157 | // OK so either the viewer didn't send a folderID or AddItem failed |
149 | UUID originalFolder = item.Folder; | 158 | UUID originalFolder = item.Folder; |
150 | InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | 159 | InventoryFolderBase f = null; |
160 | if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) | ||
161 | f = InventoryService.GetFolderForType(item.Owner, (FolderType)item.AssetType); | ||
151 | if (f != null) | 162 | if (f != null) |
152 | { | 163 | { |
153 | m_log.DebugFormat( | 164 | m_log.DebugFormat( |
@@ -179,7 +190,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | { | 190 | { |
180 | userlevel = 1; | 191 | userlevel = 1; |
181 | } | 192 | } |
182 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 193 | if (trigger) |
194 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
183 | 195 | ||
184 | if (originalFolder != UUID.Zero) | 196 | if (originalFolder != UUID.Zero) |
185 | { | 197 | { |
@@ -529,9 +541,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
529 | /// <param name="recipientClient"></param> | 541 | /// <param name="recipientClient"></param> |
530 | /// <param name="senderId">ID of the sender of the item</param> | 542 | /// <param name="senderId">ID of the sender of the item</param> |
531 | /// <param name="itemId"></param> | 543 | /// <param name="itemId"></param> |
532 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) | 544 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message) |
533 | { | 545 | { |
534 | InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); | 546 | InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message); |
535 | 547 | ||
536 | if (itemCopy != null) | 548 | if (itemCopy != null) |
537 | recipientClient.SendBulkUpdateInventory(itemCopy); | 549 | recipientClient.SendBulkUpdateInventory(itemCopy); |
@@ -544,9 +556,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
544 | /// <param name="senderId">ID of the sender of the item</param> | 556 | /// <param name="senderId">ID of the sender of the item</param> |
545 | /// <param name="itemId"></param> | 557 | /// <param name="itemId"></param> |
546 | /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> | 558 | /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> |
547 | public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) | 559 | public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message) |
548 | { | 560 | { |
549 | return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); | 561 | return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero, out message); |
550 | } | 562 | } |
551 | 563 | ||
552 | /// <summary> | 564 | /// <summary> |
@@ -563,12 +575,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | /// The inventory item copy given, null if the give was unsuccessful | 575 | /// The inventory item copy given, null if the give was unsuccessful |
564 | /// </returns> | 576 | /// </returns> |
565 | public virtual InventoryItemBase GiveInventoryItem( | 577 | public virtual InventoryItemBase GiveInventoryItem( |
566 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) | 578 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message) |
567 | { | 579 | { |
568 | //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); | 580 | //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); |
569 | 581 | ||
570 | if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) | 582 | if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) |
583 | { | ||
584 | message = "Not allowed to transfer this item."; | ||
571 | return null; | 585 | return null; |
586 | } | ||
572 | 587 | ||
573 | InventoryItemBase item = new InventoryItemBase(itemId, senderId); | 588 | InventoryItemBase item = new InventoryItemBase(itemId, senderId); |
574 | item = InventoryService.GetItem(item); | 589 | item = InventoryService.GetItem(item); |
@@ -577,6 +592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
577 | { | 592 | { |
578 | m_log.WarnFormat( | 593 | m_log.WarnFormat( |
579 | "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); | 594 | "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); |
595 | message = string.Format("Item not found: {0}.", itemId); | ||
580 | return null; | 596 | return null; |
581 | } | 597 | } |
582 | 598 | ||
@@ -585,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
585 | m_log.WarnFormat( | 601 | m_log.WarnFormat( |
586 | "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", | 602 | "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", |
587 | item.Name, item.ID, recipient, senderId, item.Owner); | 603 | item.Name, item.ID, recipient, senderId, item.Owner); |
604 | message = "Sender did not match item owner."; | ||
588 | return null; | 605 | return null; |
589 | } | 606 | } |
590 | 607 | ||
@@ -595,7 +612,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
595 | if (!Permissions.BypassPermissions()) | 612 | if (!Permissions.BypassPermissions()) |
596 | { | 613 | { |
597 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 614 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
615 | { | ||
616 | message = "Item doesn't have the Transfer permission."; | ||
598 | return null; | 617 | return null; |
618 | } | ||
599 | } | 619 | } |
600 | 620 | ||
601 | // Insert a copy of the item into the recipient | 621 | // Insert a copy of the item into the recipient |
@@ -720,7 +740,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
720 | 740 | ||
721 | if (itemCopy.Folder == UUID.Zero) | 741 | if (itemCopy.Folder == UUID.Zero) |
722 | { | 742 | { |
723 | InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType); | 743 | InventoryFolderBase folder = null; |
744 | if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) | ||
745 | folder = InventoryService.GetFolderForType(recipient, (FolderType)itemCopy.AssetType); | ||
724 | 746 | ||
725 | if (folder != null) | 747 | if (folder != null) |
726 | { | 748 | { |
@@ -731,9 +753,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
731 | InventoryFolderBase root = InventoryService.GetRootFolder(recipient); | 753 | InventoryFolderBase root = InventoryService.GetRootFolder(recipient); |
732 | 754 | ||
733 | if (root != null) | 755 | if (root != null) |
756 | { | ||
734 | itemCopy.Folder = root.ID; | 757 | itemCopy.Folder = root.ID; |
758 | } | ||
735 | else | 759 | else |
736 | return null; // No destination | 760 | { |
761 | message = "Can't find a folder to add the item to."; | ||
762 | return null; | ||
763 | } | ||
737 | } | 764 | } |
738 | } | 765 | } |
739 | 766 | ||
@@ -746,7 +773,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
746 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 773 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
747 | if (invAccess != null) | 774 | if (invAccess != null) |
748 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); | 775 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); |
749 | AddInventoryItem(itemCopy); | 776 | AddInventoryItem(itemCopy, false); |
750 | 777 | ||
751 | if (!Permissions.BypassPermissions()) | 778 | if (!Permissions.BypassPermissions()) |
752 | { | 779 | { |
@@ -758,6 +785,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
758 | } | 785 | } |
759 | } | 786 | } |
760 | 787 | ||
788 | message = null; | ||
761 | return itemCopy; | 789 | return itemCopy; |
762 | } | 790 | } |
763 | 791 | ||
@@ -775,11 +803,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | /// <returns> | 803 | /// <returns> |
776 | /// The inventory folder copy given, null if the copy was unsuccessful | 804 | /// The inventory folder copy given, null if the copy was unsuccessful |
777 | /// </returns> | 805 | /// </returns> |
778 | public virtual InventoryFolderBase GiveInventoryFolder( | 806 | public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, |
779 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) | 807 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) |
780 | { | 808 | { |
781 | //// Retrieve the folder from the sender | 809 | //// Retrieve the folder from the sender |
782 | InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId)); | 810 | InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId)); |
783 | if (null == folder) | 811 | if (null == folder) |
784 | { | 812 | { |
785 | m_log.ErrorFormat( | 813 | m_log.ErrorFormat( |
@@ -810,13 +838,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
810 | InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); | 838 | InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); |
811 | foreach (InventoryFolderBase childFolder in contents.Folders) | 839 | foreach (InventoryFolderBase childFolder in contents.Folders) |
812 | { | 840 | { |
813 | GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); | 841 | GiveInventoryFolder(client, recipientId, senderId, childFolder.ID, newFolder.ID); |
814 | } | 842 | } |
815 | 843 | ||
816 | // Give all the items | 844 | // Give all the items |
817 | foreach (InventoryItemBase item in contents.Items) | 845 | foreach (InventoryItemBase item in contents.Items) |
818 | { | 846 | { |
819 | GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); | 847 | string message; |
848 | if (GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID, out message) == null) | ||
849 | { | ||
850 | if (client != null) | ||
851 | client.SendAgentAlertMessage(message, false); | ||
852 | } | ||
820 | } | 853 | } |
821 | 854 | ||
822 | return newFolder; | 855 | return newFolder; |
@@ -848,53 +881,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
848 | return; | 881 | return; |
849 | } | 882 | } |
850 | 883 | ||
884 | <<<<<<< HEAD | ||
885 | if (newName == String.Empty) | ||
886 | newName = item.Name; | ||
887 | ======= | ||
851 | if (newName == null) newName = item.Name; | 888 | if (newName == null) newName = item.Name; |
852 | 889 | ||
853 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 890 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
891 | >>>>>>> avn/ubitvar | ||
854 | 892 | ||
855 | if (asset != null) | 893 | if (remoteClient.AgentId == oldAgentID |
894 | || (LibraryService != null | ||
895 | && LibraryService.LibraryRootFolder != null | ||
896 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
856 | { | 897 | { |
857 | if (newName != String.Empty) | 898 | CreateNewInventoryItem( |
858 | { | 899 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, |
859 | asset.Name = newName; | 900 | newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType, |
860 | } | 901 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, |
861 | else | 902 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false); |
862 | { | 903 | } |
863 | newName = item.Name; | 904 | else |
864 | } | 905 | { |
865 | 906 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | |
866 | if (remoteClient.AgentId == oldAgentID | 907 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) |
867 | || (LibraryService != null | 908 | && (m_permissions.BypassPermissions() |
868 | && LibraryService.LibraryRootFolder != null | 909 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) |
869 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
870 | { | 910 | { |
871 | CreateNewInventoryItem( | 911 | CreateNewInventoryItem( |
872 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, | 912 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, |
873 | newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, | 913 | item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType, |
874 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, | 914 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, |
875 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 915 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false); |
876 | } | ||
877 | else | ||
878 | { | ||
879 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | ||
880 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) | ||
881 | && (m_permissions.BypassPermissions() | ||
882 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) | ||
883 | { | ||
884 | CreateNewInventoryItem( | ||
885 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, | ||
886 | asset, (sbyte) item.InvType, | ||
887 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, | ||
888 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | ||
889 | } | ||
890 | } | 916 | } |
891 | } | 917 | } |
892 | else | ||
893 | { | ||
894 | m_log.ErrorFormat( | ||
895 | "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", | ||
896 | item.Name, item.AssetID); | ||
897 | } | ||
898 | } | 918 | } |
899 | 919 | ||
900 | /// <summary> | 920 | /// <summary> |
@@ -962,6 +982,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
962 | public void CreateNewInventoryItem( | 982 | public void CreateNewInventoryItem( |
963 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 983 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
964 | string name, string description, uint flags, uint callbackID, | 984 | string name, string description, uint flags, uint callbackID, |
985 | <<<<<<< HEAD | ||
986 | UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate) | ||
987 | { | ||
988 | CreateNewInventoryItem( | ||
989 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType, | ||
990 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, | ||
991 | creationDate, true); | ||
992 | ======= | ||
965 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) | 993 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) |
966 | { | 994 | { |
967 | CreateNewInventoryItem( | 995 | CreateNewInventoryItem( |
@@ -978,6 +1006,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
978 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, | 1006 | CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, |
979 | name, description, flags, callbackID, asset, invType, | 1007 | name, description, flags, callbackID, asset, invType, |
980 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); | 1008 | baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); |
1009 | >>>>>>> avn/ubitvar | ||
981 | } | 1010 | } |
982 | 1011 | ||
983 | /// <summary> | 1012 | /// <summary> |
@@ -1001,19 +1030,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
1001 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> | 1030 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> |
1002 | private void CreateNewInventoryItem( | 1031 | private void CreateNewInventoryItem( |
1003 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 1032 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
1033 | <<<<<<< HEAD | ||
1034 | string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, | ||
1035 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate, | ||
1036 | bool assetUpload) | ||
1037 | ======= | ||
1004 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 1038 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
1005 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) | 1039 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) |
1040 | >>>>>>> avn/ubitvar | ||
1006 | { | 1041 | { |
1007 | InventoryItemBase item = new InventoryItemBase(); | 1042 | InventoryItemBase item = new InventoryItemBase(); |
1008 | item.Owner = remoteClient.AgentId; | 1043 | item.Owner = remoteClient.AgentId; |
1009 | item.CreatorId = creatorID; | 1044 | item.CreatorId = creatorID; |
1010 | item.CreatorData = creatorData; | 1045 | item.CreatorData = creatorData; |
1011 | item.ID = UUID.Random(); | 1046 | item.ID = UUID.Random(); |
1012 | item.AssetID = asset.FullID; | 1047 | item.AssetID = assetID; |
1013 | item.Name = name; | 1048 | item.Name = name; |
1014 | item.Description = description; | 1049 | item.Description = description; |
1015 | item.Flags = flags; | 1050 | item.Flags = flags; |
1016 | item.AssetType = asset.Type; | 1051 | item.AssetType = assetType; |
1017 | item.InvType = invType; | 1052 | item.InvType = invType; |
1018 | item.Folder = folderID; | 1053 | item.Folder = folderID; |
1019 | item.CurrentPermissions = currentMask; | 1054 | item.CurrentPermissions = currentMask; |
@@ -1023,11 +1058,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1023 | item.BasePermissions = baseMask; | 1058 | item.BasePermissions = baseMask; |
1024 | item.CreationDate = creationDate; | 1059 | item.CreationDate = creationDate; |
1025 | 1060 | ||
1061 | <<<<<<< HEAD | ||
1062 | if (AddInventoryItem(item, assetUpload)) | ||
1063 | ======= | ||
1026 | // special AnimationSet case | 1064 | // special AnimationSet case |
1027 | if (item.InvType == (int)CustomInventoryType.AnimationSet) | 1065 | if (item.InvType == (int)CustomInventoryType.AnimationSet) |
1028 | AnimationSet.enforceItemPermitions(item,true); | 1066 | AnimationSet.enforceItemPermitions(item,true); |
1029 | 1067 | ||
1030 | if (AddInventoryItem(item)) | 1068 | if (AddInventoryItem(item)) |
1069 | >>>>>>> avn/ubitvar | ||
1031 | { | 1070 | { |
1032 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); | 1071 | remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); |
1033 | } | 1072 | } |
@@ -1090,17 +1129,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1090 | // return; | 1129 | // return; |
1091 | // } | 1130 | // } |
1092 | 1131 | ||
1093 | AssetBase asset = new AssetBase(); | ||
1094 | asset.FullID = olditemID; | ||
1095 | asset.Type = type; | ||
1096 | asset.Name = name; | ||
1097 | asset.Description = description; | ||
1098 | |||
1099 | CreateNewInventoryItem( | 1132 | CreateNewInventoryItem( |
1100 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 1133 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
1101 | name, description, 0, callbackID, asset, invType, | 1134 | name, description, 0, callbackID, olditemID, type, invType, |
1102 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, | 1135 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, |
1103 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); | 1136 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch(), |
1137 | false); | ||
1104 | } | 1138 | } |
1105 | else | 1139 | else |
1106 | { | 1140 | { |
@@ -1176,13 +1210,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1176 | if (item == null) | 1210 | if (item == null) |
1177 | return; | 1211 | return; |
1178 | 1212 | ||
1179 | InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); | 1213 | InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Trash); |
1180 | 1214 | ||
1181 | // Move the item to trash. If this is a copiable item, only | 1215 | // Move the item to trash. If this is a copyable item, only |
1182 | // a copy will be moved and we will still need to delete | 1216 | // a copy will be moved and we will still need to delete |
1183 | // the item from the prim. If it was no copy, is will be | 1217 | // the item from the prim. If it was no copy, it will be |
1184 | // deleted by this method. | 1218 | // deleted by this method. |
1185 | MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); | 1219 | string message; |
1220 | InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID, out message); | ||
1221 | |||
1222 | if (item2 == null) | ||
1223 | { | ||
1224 | m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message); | ||
1225 | remoteClient.SendAgentAlertMessage(message, false); | ||
1226 | return; | ||
1227 | } | ||
1186 | 1228 | ||
1187 | if (group.GetInventoryItem(localID, itemID) != null) | 1229 | if (group.GetInventoryItem(localID, itemID) != null) |
1188 | { | 1230 | { |
@@ -1194,11 +1236,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1194 | 1236 | ||
1195 | group.RemoveInventoryItem(localID, itemID); | 1237 | group.RemoveInventoryItem(localID, itemID); |
1196 | } | 1238 | } |
1239 | |||
1197 | part.SendPropertiesToClient(remoteClient); | 1240 | part.SendPropertiesToClient(remoteClient); |
1198 | } | 1241 | } |
1199 | } | 1242 | } |
1200 | 1243 | ||
1201 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) | 1244 | |
1245 | /// <summary> | ||
1246 | /// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item. | ||
1247 | /// </summary> | ||
1248 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message) | ||
1202 | { | 1249 | { |
1203 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); | 1250 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); |
1204 | 1251 | ||
@@ -1209,12 +1256,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1209 | + " inventory item from a prim's inventory item " | 1256 | + " inventory item from a prim's inventory item " |
1210 | + " but the required item does not exist in the prim's inventory", | 1257 | + " but the required item does not exist in the prim's inventory", |
1211 | itemId, part.Name, part.UUID); | 1258 | itemId, part.Name, part.UUID); |
1212 | 1259 | message = "Item not found: " + itemId; | |
1213 | return null; | 1260 | return null; |
1214 | } | 1261 | } |
1215 | 1262 | ||
1216 | if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1263 | if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) |
1217 | { | 1264 | { |
1265 | message = "Item doesn't have the Transfer permission."; | ||
1218 | return null; | 1266 | return null; |
1219 | } | 1267 | } |
1220 | 1268 | ||
@@ -1236,11 +1284,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1284 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
1237 | if (taskItem.InvType == (int)InventoryType.Object) | 1285 | if (taskItem.InvType == (int)InventoryType.Object) |
1238 | { | 1286 | { |
1287 | <<<<<<< HEAD | ||
1288 | // Bake the new base permissions from folded permissions | ||
1289 | // The folded perms are in the lowest 3 bits of the current perms | ||
1290 | // We use base permissions here to avoid baking the "Locked" status | ||
1291 | // into the item as it is passed. | ||
1292 | uint perms = taskItem.BasePermissions & taskItem.NextPermissions; | ||
1293 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | ||
1294 | // Avoid the "lock trap" - move must always be enabled but the above may remove it | ||
1295 | // Add it back here. | ||
1296 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | ||
1297 | // Newly given items cannot be "locked" on rez. Make sure by | ||
1298 | // setting current equal to base. | ||
1299 | ======= | ||
1239 | uint perms = taskItem.BasePermissions & taskItem.NextPermissions; | 1300 | uint perms = taskItem.BasePermissions & taskItem.NextPermissions; |
1240 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); | 1301 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); |
1241 | // agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | 1302 | // agentItem.BasePermissions = perms | (uint)PermissionMask.Move; |
1242 | // agentItem.CurrentPermissions = agentItem.BasePermissions; | 1303 | // agentItem.CurrentPermissions = agentItem.BasePermissions; |
1243 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; | 1304 | agentItem.BasePermissions = perms | (uint)PermissionMask.Move; |
1305 | >>>>>>> avn/ubitvar | ||
1244 | } | 1306 | } |
1245 | 1307 | ||
1246 | agentItem.CurrentPermissions = agentItem.BasePermissions; | 1308 | agentItem.CurrentPermissions = agentItem.BasePermissions; |
@@ -1259,11 +1321,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1259 | agentItem.GroupPermissions = taskItem.GroupPermissions; | 1321 | agentItem.GroupPermissions = taskItem.GroupPermissions; |
1260 | } | 1322 | } |
1261 | 1323 | ||
1324 | message = null; | ||
1325 | return agentItem; | ||
1326 | } | ||
1327 | |||
1328 | /// <summary> | ||
1329 | /// If the task item is not-copyable then remove it from the prim. | ||
1330 | /// </summary> | ||
1331 | private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId) | ||
1332 | { | ||
1333 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); | ||
1334 | if (taskItem == null) | ||
1335 | return; | ||
1336 | |||
1262 | if (!Permissions.BypassPermissions()) | 1337 | if (!Permissions.BypassPermissions()) |
1263 | { | 1338 | { |
1264 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1339 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1265 | { | 1340 | { |
1266 | if (taskItem.Type == 10) | 1341 | if (taskItem.Type == (int)AssetType.LSLText) |
1267 | { | 1342 | { |
1268 | part.RemoveScriptEvents(itemId); | 1343 | part.RemoveScriptEvents(itemId); |
1269 | EventManager.TriggerRemoveScript(part.LocalId, itemId); | 1344 | EventManager.TriggerRemoveScript(part.LocalId, itemId); |
@@ -1272,8 +1347,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1272 | part.Inventory.RemoveInventoryItem(itemId); | 1347 | part.Inventory.RemoveInventoryItem(itemId); |
1273 | } | 1348 | } |
1274 | } | 1349 | } |
1275 | |||
1276 | return agentItem; | ||
1277 | } | 1350 | } |
1278 | 1351 | ||
1279 | /// <summary> | 1352 | /// <summary> |
@@ -1283,19 +1356,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1283 | /// <param name="folderID"></param> | 1356 | /// <param name="folderID"></param> |
1284 | /// <param name="part"></param> | 1357 | /// <param name="part"></param> |
1285 | /// <param name="itemID"></param> | 1358 | /// <param name="itemID"></param> |
1286 | public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) | 1359 | public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message) |
1287 | { | 1360 | { |
1288 | m_log.DebugFormat( | 1361 | m_log.DebugFormat( |
1289 | "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", | 1362 | "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", |
1290 | itemId, part.Name, folderId, remoteClient.Name); | 1363 | itemId, part.Name, folderId, remoteClient.Name); |
1291 | 1364 | ||
1292 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); | 1365 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message); |
1293 | |||
1294 | if (agentItem == null) | 1366 | if (agentItem == null) |
1295 | return null; | 1367 | return null; |
1296 | 1368 | ||
1297 | agentItem.Folder = folderId; | 1369 | agentItem.Folder = folderId; |
1298 | AddInventoryItem(remoteClient, agentItem); | 1370 | AddInventoryItem(remoteClient, agentItem); |
1371 | |||
1372 | RemoveNonCopyTaskItemFromPrim(part, itemId); | ||
1373 | |||
1374 | message = null; | ||
1299 | return agentItem; | 1375 | return agentItem; |
1300 | } | 1376 | } |
1301 | 1377 | ||
@@ -1350,7 +1426,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1350 | return; | 1426 | return; |
1351 | } | 1427 | } |
1352 | 1428 | ||
1353 | MoveTaskInventoryItem(remoteClient, folderId, part, itemId); | 1429 | string message; |
1430 | InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message); | ||
1431 | |||
1432 | if (item == null) | ||
1433 | remoteClient.SendAgentAlertMessage(message, false); | ||
1354 | } | 1434 | } |
1355 | 1435 | ||
1356 | /// <summary> | 1436 | /// <summary> |
@@ -1364,17 +1444,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1364 | /// </param> | 1444 | /// </param> |
1365 | /// <param name="part"></param> | 1445 | /// <param name="part"></param> |
1366 | /// <param name="itemID"></param> | 1446 | /// <param name="itemID"></param> |
1367 | public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) | 1447 | public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message) |
1368 | { | 1448 | { |
1369 | ScenePresence avatar; | 1449 | ScenePresence avatar; |
1370 | 1450 | ||
1371 | if (TryGetScenePresence(avatarId, out avatar)) | 1451 | if (TryGetScenePresence(avatarId, out avatar)) |
1372 | { | 1452 | { |
1373 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); | 1453 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message); |
1374 | } | 1454 | } |
1375 | else | 1455 | else |
1376 | { | 1456 | { |
1377 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); | 1457 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message); |
1378 | 1458 | ||
1379 | if (agentItem == null) | 1459 | if (agentItem == null) |
1380 | return null; | 1460 | return null; |
@@ -1383,6 +1463,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1383 | 1463 | ||
1384 | AddInventoryItem(agentItem); | 1464 | AddInventoryItem(agentItem); |
1385 | 1465 | ||
1466 | RemoveNonCopyTaskItemFromPrim(part, itemId); | ||
1467 | |||
1386 | return agentItem; | 1468 | return agentItem; |
1387 | } | 1469 | } |
1388 | } | 1470 | } |
@@ -1495,6 +1577,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1495 | 1577 | ||
1496 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1578 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1497 | { | 1579 | { |
1580 | <<<<<<< HEAD | ||
1581 | ScenePresence avatar; | ||
1582 | IClientAPI remoteClient = null; | ||
1583 | if (TryGetScenePresence(destID, out avatar)) | ||
1584 | remoteClient = avatar.ControllingClient; | ||
1585 | ======= | ||
1498 | SceneObjectPart destPart = GetSceneObjectPart(destID); | 1586 | SceneObjectPart destPart = GetSceneObjectPart(destID); |
1499 | if (destPart != null) // Move into a prim | 1587 | if (destPart != null) // Move into a prim |
1500 | { | 1588 | { |
@@ -1502,6 +1590,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1502 | MoveTaskInventoryItem(destID, host, itemID); | 1590 | MoveTaskInventoryItem(destID, host, itemID); |
1503 | return destID; // Prim folder ID == prim ID | 1591 | return destID; // Prim folder ID == prim ID |
1504 | } | 1592 | } |
1593 | >>>>>>> avn/ubitvar | ||
1505 | 1594 | ||
1506 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1595 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1507 | 1596 | ||
@@ -1512,26 +1601,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1512 | 1601 | ||
1513 | foreach (UUID itemID in items) | 1602 | foreach (UUID itemID in items) |
1514 | { | 1603 | { |
1515 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); | 1604 | string message; |
1605 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message); | ||
1516 | 1606 | ||
1517 | if (agentItem != null) | 1607 | if (agentItem != null) |
1518 | { | 1608 | { |
1519 | agentItem.Folder = newFolderID; | 1609 | agentItem.Folder = newFolderID; |
1520 | 1610 | ||
1521 | AddInventoryItem(agentItem); | 1611 | AddInventoryItem(agentItem); |
1612 | |||
1613 | RemoveNonCopyTaskItemFromPrim(host, itemID); | ||
1614 | } | ||
1615 | else | ||
1616 | { | ||
1617 | if (remoteClient != null) | ||
1618 | remoteClient.SendAgentAlertMessage(message, false); | ||
1522 | } | 1619 | } |
1523 | } | 1620 | } |
1524 | 1621 | ||
1525 | ScenePresence avatar = null; | 1622 | if (remoteClient != null) |
1526 | if (TryGetScenePresence(destID, out avatar)) | ||
1527 | { | 1623 | { |
1528 | //profile.SendInventoryDecendents(avatar.ControllingClient, | 1624 | SendInventoryUpdate(remoteClient, rootFolder, true, false); |
1529 | // profile.RootFolder.ID, true, false); | 1625 | SendInventoryUpdate(remoteClient, newFolder, false, true); |
1530 | //profile.SendInventoryDecendents(avatar.ControllingClient, | ||
1531 | // newFolderID, false, true); | ||
1532 | |||
1533 | SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false); | ||
1534 | SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true); | ||
1535 | } | 1626 | } |
1536 | 1627 | ||
1537 | return newFolderID; | 1628 | return newFolderID; |
@@ -1935,8 +2026,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1935 | /// Rez a script into a prim's inventory from another prim | 2026 | /// Rez a script into a prim's inventory from another prim |
1936 | /// </summary> | 2027 | /// </summary> |
1937 | /// <param name="remoteClient"></param> | 2028 | /// <param name="remoteClient"></param> |
1938 | /// <param name="itemID"> </param> | 2029 | /// <param name="srcPart"> </param> |
1939 | /// <param name="localID"></param> | 2030 | /// <param name="destId"> </param> |
2031 | /// <param name="pin"></param> | ||
2032 | /// <param name="running"></param> | ||
2033 | /// <param name="start_param"></param> | ||
1940 | public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) | 2034 | public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) |
1941 | { | 2035 | { |
1942 | TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); | 2036 | TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); |
@@ -1956,12 +2050,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1956 | if (destPart == null) | 2050 | if (destPart == null) |
1957 | { | 2051 | { |
1958 | m_log.ErrorFormat( | 2052 | m_log.ErrorFormat( |
1959 | "[PRIM INVENTORY]: " + | 2053 | "[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}", |
1960 | "Could not find script for ID {0}", | 2054 | destId, srcId, srcPart.Name, srcPart.UUID, Name); |
1961 | destId); | ||
1962 | return; | 2055 | return; |
1963 | } | 2056 | } |
1964 | 2057 | ||
1965 | // Must own the object, and have modify rights | 2058 | // Must own the object, and have modify rights |
1966 | if (srcPart.OwnerID != destPart.OwnerID) | 2059 | if (srcPart.OwnerID != destPart.OwnerID) |
1967 | { | 2060 | { |
@@ -1969,7 +2062,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || | 2062 | if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || |
1970 | ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0)) | 2063 | ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0)) |
1971 | return; | 2064 | return; |
1972 | } else { | 2065 | } |
2066 | else | ||
2067 | { | ||
1973 | if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) | 2068 | if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1974 | return; | 2069 | return; |
1975 | } | 2070 | } |
@@ -2094,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2094 | SceneObjectGroup grp = part.ParentGroup; | 2189 | SceneObjectGroup grp = part.ParentGroup; |
2095 | 2190 | ||
2096 | // If child prims have invalid perms, fix them | 2191 | // If child prims have invalid perms, fix them |
2097 | grp.AdjustChildPrimPermissions(); | 2192 | grp.AdjustChildPrimPermissions(false); |
2098 | 2193 | ||
2099 | if (remoteClient == null) | 2194 | if (remoteClient == null) |
2100 | { | 2195 | { |
@@ -2192,15 +2287,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2192 | } | 2287 | } |
2193 | } | 2288 | } |
2194 | 2289 | ||
2290 | <<<<<<< HEAD | ||
2291 | // OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted | ||
2292 | bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action); | ||
2293 | |||
2294 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | ||
2295 | ======= | ||
2195 | SendKillObject(deleteIDs); | 2296 | SendKillObject(deleteIDs); |
2196 | 2297 | ||
2197 | if (deleteGroups.Count > 0) | 2298 | if (deleteGroups.Count > 0) |
2299 | >>>>>>> avn/ubitvar | ||
2198 | { | 2300 | { |
2199 | foreach (SceneObjectGroup g in deleteGroups) | 2301 | foreach (SceneObjectGroup g in deleteGroups) |
2200 | deleteIDs.Remove(g.LocalId); | 2302 | deleteIDs.Remove(g.LocalId); |
2201 | 2303 | ||
2202 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2304 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2203 | action, destinationID, deleteGroups, remoteClient, | 2305 | action, destinationID, deleteGroups, remoteClient, |
2306 | <<<<<<< HEAD | ||
2307 | permissionToDelete && canDelete); | ||
2308 | } | ||
2309 | else if (permissionToDelete && canDelete) | ||
2310 | ======= | ||
2204 | true); | 2311 | true); |
2205 | } | 2312 | } |
2206 | if (takeGroups.Count > 0) | 2313 | if (takeGroups.Count > 0) |
@@ -2210,6 +2317,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2210 | false); | 2317 | false); |
2211 | } | 2318 | } |
2212 | if (deleteIDs.Count > 0) | 2319 | if (deleteIDs.Count > 0) |
2320 | >>>>>>> avn/ubitvar | ||
2213 | { | 2321 | { |
2214 | foreach (SceneObjectGroup g in deleteGroups) | 2322 | foreach (SceneObjectGroup g in deleteGroups) |
2215 | DeleteSceneObject(g, true); | 2323 | DeleteSceneObject(g, true); |
@@ -2306,24 +2414,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
2306 | /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object. | 2414 | /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object. |
2307 | /// </remarks> | 2415 | /// </remarks> |
2308 | /// <param name="assetData">Asset data</param> | 2416 | /// <param name="assetData">Asset data</param> |
2309 | /// <param name="attachment">Whether the item is an attachment</param> | 2417 | /// <param name="isAttachment">True if the object is an attachment.</param> |
2310 | /// <param name="objlist">The objects included in the asset</param> | 2418 | /// <param name="objlist">The objects included in the asset</param> |
2311 | /// <param name="veclist">Relative positions of the objects</param> | 2419 | /// <param name="veclist">Relative positions of the objects</param> |
2312 | /// <param name="bbox">Bounding box of all the objects</param> | 2420 | /// <param name="bbox">Bounding box of all the objects</param> |
2313 | /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box | 2421 | /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box |
2314 | /// to the centre of the root prim (relevant only when returning a single object)</param> | 2422 | /// to the centre of the root prim (relevant only when returning a single object)</param> |
2315 | /// <returns>true = returning a single object; false = multiple objects</returns> | 2423 | /// <returns> |
2316 | public bool GetObjectsToRez(byte[] assetData, bool attachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, | 2424 | /// true if returning a single object or deserialization fails, false if returning the coalesced |
2425 | /// list of objects | ||
2426 | /// </returns> | ||
2427 | public bool GetObjectsToRez( | ||
2428 | byte[] assetData, bool isAttachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, | ||
2317 | out Vector3 bbox, out float offsetHeight) | 2429 | out Vector3 bbox, out float offsetHeight) |
2318 | { | 2430 | { |
2319 | objlist = new List<SceneObjectGroup>(); | 2431 | objlist = new List<SceneObjectGroup>(); |
2320 | veclist = new List<Vector3>(); | 2432 | veclist = new List<Vector3>(); |
2433 | bbox = Vector3.Zero; | ||
2434 | offsetHeight = 0; | ||
2321 | 2435 | ||
2322 | XmlDocument doc = new XmlDocument(); | 2436 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData)); |
2323 | string xmlData = Utils.BytesToString(assetData); | ||
2324 | doc.LoadXml(xmlData); | ||
2325 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
2326 | 2437 | ||
2438 | <<<<<<< HEAD | ||
2439 | try | ||
2440 | ======= | ||
2327 | if (e == null || attachment) // Single | 2441 | if (e == null || attachment) // Single |
2328 | { | 2442 | { |
2329 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 2443 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
@@ -2344,17 +2458,75 @@ namespace OpenSim.Region.Framework.Scenes | |||
2344 | return true; | 2458 | return true; |
2345 | } | 2459 | } |
2346 | else | 2460 | else |
2461 | >>>>>>> avn/ubitvar | ||
2347 | { | 2462 | { |
2348 | XmlElement coll = (XmlElement)e; | 2463 | using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) |
2349 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
2350 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
2351 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
2352 | bbox = new Vector3(bx, by, bz); | ||
2353 | offsetHeight = 0; | ||
2354 | |||
2355 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
2356 | foreach (XmlNode n in groups) | ||
2357 | { | 2464 | { |
2465 | <<<<<<< HEAD | ||
2466 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | ||
2467 | { | ||
2468 | reader.Read(); | ||
2469 | bool isSingleObject = reader.Name != "CoalescedObject"; | ||
2470 | |||
2471 | if (isSingleObject || isAttachment) | ||
2472 | { | ||
2473 | SceneObjectGroup g; | ||
2474 | try | ||
2475 | { | ||
2476 | g = SceneObjectSerializer.FromOriginalXmlFormat(reader); | ||
2477 | } | ||
2478 | catch (Exception e) | ||
2479 | { | ||
2480 | m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed ", e); | ||
2481 | Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); | ||
2482 | g = null; | ||
2483 | } | ||
2484 | |||
2485 | if (g != null) | ||
2486 | { | ||
2487 | objlist.Add(g); | ||
2488 | veclist.Add(Vector3.Zero); | ||
2489 | bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); | ||
2490 | } | ||
2491 | |||
2492 | return true; | ||
2493 | } | ||
2494 | else | ||
2495 | { | ||
2496 | XmlDocument doc = new XmlDocument(); | ||
2497 | doc.LoadXml(xmlData); | ||
2498 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
2499 | XmlElement coll = (XmlElement)e; | ||
2500 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
2501 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
2502 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
2503 | bbox = new Vector3(bx, by, bz); | ||
2504 | offsetHeight = 0; | ||
2505 | |||
2506 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
2507 | foreach (XmlNode n in groups) | ||
2508 | { | ||
2509 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | ||
2510 | if (g != null) | ||
2511 | { | ||
2512 | objlist.Add(g); | ||
2513 | |||
2514 | XmlElement el = (XmlElement)n; | ||
2515 | string rawX = el.GetAttribute("offsetx"); | ||
2516 | string rawY = el.GetAttribute("offsety"); | ||
2517 | string rawZ = el.GetAttribute("offsetz"); | ||
2518 | |||
2519 | float x = Convert.ToSingle(rawX); | ||
2520 | float y = Convert.ToSingle(rawY); | ||
2521 | float z = Convert.ToSingle(rawZ); | ||
2522 | veclist.Add(new Vector3(x, y, z)); | ||
2523 | } | ||
2524 | } | ||
2525 | |||
2526 | return false; | ||
2527 | } | ||
2528 | } | ||
2529 | ======= | ||
2358 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 2530 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
2359 | /* | 2531 | /* |
2360 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | 2532 | g.RootPart.AttachPoint = g.RootPart.Shape.State; |
@@ -2375,10 +2547,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2375 | float y = Convert.ToSingle(rawY); | 2547 | float y = Convert.ToSingle(rawY); |
2376 | float z = Convert.ToSingle(rawZ); | 2548 | float z = Convert.ToSingle(rawZ); |
2377 | veclist.Add(new Vector3(x, y, z)); | 2549 | veclist.Add(new Vector3(x, y, z)); |
2550 | >>>>>>> avn/ubitvar | ||
2378 | } | 2551 | } |
2379 | } | 2552 | } |
2553 | catch (Exception e) | ||
2554 | { | ||
2555 | m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag ", e); | ||
2556 | Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); | ||
2557 | } | ||
2380 | 2558 | ||
2381 | return false; | 2559 | return true; |
2382 | } | 2560 | } |
2383 | 2561 | ||
2384 | /// <summary> | 2562 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 931093a..3d9c028 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -133,6 +133,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
133 | } | 133 | } |
134 | 134 | ||
135 | /// <summary> | 135 | /// <summary> |
136 | /// | ||
137 | /// </summary> | ||
138 | /// <param name="message"></param> | ||
139 | /// <param name="type"></param> | ||
140 | /// <param name="channel"></param> | ||
141 | /// <param name="fromPos"></param> | ||
142 | /// <param name="fromName"></param> | ||
143 | /// <param name="fromAgentID"></param> | ||
144 | /// <param name="targetID"></param> | ||
145 | public void SimChatToAgent(UUID targetID, byte[] message, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) | ||
146 | { | ||
147 | SimChat(message, ChatTypeEnum.Region, channel, fromPos, fromName, fromID, targetID, fromAgent, false); | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
136 | /// Invoked when the client requests a prim. | 151 | /// Invoked when the client requests a prim. |
137 | /// </summary> | 152 | /// </summary> |
138 | /// <param name="primLocalID"></param> | 153 | /// <param name="primLocalID"></param> |
@@ -536,8 +551,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
536 | 551 | ||
537 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 552 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) |
538 | { | 553 | { |
554 | <<<<<<< HEAD | ||
555 | try | ||
556 | { | ||
557 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | ||
558 | } | ||
559 | catch (Exception e) | ||
560 | { | ||
561 | m_log.Error( | ||
562 | string.Format( | ||
563 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); | ||
564 | } | ||
565 | ======= | ||
539 | Thread.Sleep(20); | 566 | Thread.Sleep(20); |
540 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | 567 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); |
568 | >>>>>>> avn/ubitvar | ||
541 | } | 569 | } |
542 | 570 | ||
543 | void SendInventoryComplete(IAsyncResult iar) | 571 | void SendInventoryComplete(IAsyncResult iar) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 61e31e4..deb8d39 100644..100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
48 | using OpenSim.Region.Framework.Scenes.Scripting; | 48 | using OpenSim.Region.Framework.Scenes.Scripting; |
49 | using OpenSim.Region.Framework.Scenes.Serialization; | 49 | using OpenSim.Region.Framework.Scenes.Serialization; |
50 | using OpenSim.Region.Physics.Manager; | 50 | using OpenSim.Region.Physics.Manager; |
51 | using Timer=System.Timers.Timer; | 51 | using Timer = System.Timers.Timer; |
52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
54 | using PermissionMask = OpenSim.Framework.PermissionMask; | 54 | using PermissionMask = OpenSim.Framework.PermissionMask; |
@@ -61,6 +61,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | { | 61 | { |
62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; | 62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; |
63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; | 63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; |
64 | |||
65 | public const int m_defaultNumberFramesStored = 10; | ||
64 | 66 | ||
65 | public delegate void SynchronizeSceneHandler(Scene scene); | 67 | public delegate void SynchronizeSceneHandler(Scene scene); |
66 | 68 | ||
@@ -103,9 +105,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// <summary> | 105 | /// <summary> |
104 | /// If false then physical objects are disabled, though collisions will continue as normal. | 106 | /// If false then physical objects are disabled, though collisions will continue as normal. |
105 | /// </summary> | 107 | /// </summary> |
108 | <<<<<<< HEAD | ||
109 | public bool PhysicsEnabled | ||
110 | { | ||
111 | get | ||
112 | ======= | ||
106 | public bool PhysicsEnabled | 113 | public bool PhysicsEnabled |
107 | { | 114 | { |
108 | get | 115 | get |
116 | >>>>>>> avn/ubitvar | ||
109 | { | 117 | { |
110 | return m_physicsEnabled; | 118 | return m_physicsEnabled; |
111 | } | 119 | } |
@@ -130,10 +138,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | /// <summary> | 138 | /// <summary> |
131 | /// If false then scripts are not enabled on the smiulator | 139 | /// If false then scripts are not enabled on the smiulator |
132 | /// </summary> | 140 | /// </summary> |
133 | public bool ScriptsEnabled | 141 | public bool ScriptsEnabled |
134 | { | 142 | { |
135 | get { return m_scripts_enabled; } | 143 | get { return m_scripts_enabled; } |
136 | set | 144 | set |
137 | { | 145 | { |
138 | if (m_scripts_enabled != value) | 146 | if (m_scripts_enabled != value) |
139 | { | 147 | { |
@@ -151,7 +159,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
151 | else | 159 | else |
152 | { | 160 | { |
153 | m_log.Info("Starting all Scripts in Scene"); | 161 | m_log.Info("Starting all Scripts in Scene"); |
154 | 162 | ||
155 | EntityBase[] entities = Entities.GetEntities(); | 163 | EntityBase[] entities = Entities.GetEntities(); |
156 | foreach (EntityBase ent in entities) | 164 | foreach (EntityBase ent in entities) |
157 | { | 165 | { |
@@ -214,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | /// <summary> | 222 | /// <summary> |
215 | /// Maximum value of the size of a physical prim in each axis | 223 | /// Maximum value of the size of a physical prim in each axis |
216 | /// </summary> | 224 | /// </summary> |
217 | public float m_maxPhys = 10; | 225 | public float m_maxPhys = 64; |
218 | 226 | ||
219 | /// <summary> | 227 | /// <summary> |
220 | /// Max prims an object will hold | 228 | /// Max prims an object will hold |
@@ -226,10 +234,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | public bool m_allowScriptCrossings = true; | 234 | public bool m_allowScriptCrossings = true; |
227 | 235 | ||
228 | /// <summary> | 236 | /// <summary> |
237 | <<<<<<< HEAD | ||
238 | /// Can avatars cross from and to this region? | ||
239 | /// </summary> | ||
240 | public bool AllowAvatarCrossing { get; set; } | ||
241 | ======= | ||
229 | /// Max prims an Physical object will hold | 242 | /// Max prims an Physical object will hold |
230 | /// </summary> | 243 | /// </summary> |
231 | /// | 244 | /// |
232 | public int m_linksetPhysCapacity = 0; | 245 | public int m_linksetPhysCapacity = 0; |
246 | >>>>>>> avn/ubitvar | ||
233 | 247 | ||
234 | public bool m_useFlySlow; | 248 | public bool m_useFlySlow; |
235 | public bool m_useTrashOnDelete = true; | 249 | public bool m_useTrashOnDelete = true; |
@@ -239,10 +253,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
239 | /// </summary> | 253 | /// </summary> |
240 | public bool SendPeriodicAppearanceUpdates { get; set; } | 254 | public bool SendPeriodicAppearanceUpdates { get; set; } |
241 | 255 | ||
256 | /// <summary> | ||
257 | /// How much a root agent has to change position before updates are sent to viewers. | ||
258 | /// </summary> | ||
259 | public float RootPositionUpdateTolerance { get; set; } | ||
260 | |||
261 | /// <summary> | ||
262 | /// How much a root agent has to rotate before updates are sent to viewers. | ||
263 | /// </summary> | ||
264 | public float RootRotationUpdateTolerance { get; set; } | ||
265 | |||
266 | /// <summary> | ||
267 | /// How much a root agent has to change velocity before updates are sent to viewers. | ||
268 | /// </summary> | ||
269 | public float RootVelocityUpdateTolerance { get; set; } | ||
270 | |||
271 | /// <summary> | ||
272 | /// If greater than 1, we only send terse updates to other root agents on every n updates. | ||
273 | /// </summary> | ||
274 | public int RootTerseUpdatePeriod { get; set; } | ||
275 | |||
276 | /// <summary> | ||
277 | /// If greater than 1, we only send terse updates to child agents on every n updates. | ||
278 | /// </summary> | ||
279 | public int ChildTerseUpdatePeriod { get; set; } | ||
280 | |||
242 | protected float m_defaultDrawDistance = 255.0f; | 281 | protected float m_defaultDrawDistance = 255.0f; |
243 | public float DefaultDrawDistance | 282 | public float DefaultDrawDistance |
244 | { | 283 | { |
245 | get { return m_defaultDrawDistance; } | 284 | // get { return m_defaultDrawDistance; } |
285 | get | ||
286 | { | ||
287 | if (RegionInfo != null) | ||
288 | { | ||
289 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | ||
290 | m_defaultDrawDistance = Math.Max(m_defaultDrawDistance, largestDimension); | ||
291 | |||
292 | } | ||
293 | return m_defaultDrawDistance; | ||
294 | } | ||
246 | } | 295 | } |
247 | 296 | ||
248 | protected float m_maxDrawDistance = 512.0f; | 297 | protected float m_maxDrawDistance = 512.0f; |
@@ -254,7 +303,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
254 | 303 | ||
255 | private List<string> m_AllowedViewers = new List<string>(); | 304 | private List<string> m_AllowedViewers = new List<string>(); |
256 | private List<string> m_BannedViewers = new List<string>(); | 305 | private List<string> m_BannedViewers = new List<string>(); |
257 | 306 | ||
258 | // TODO: need to figure out how allow client agents but deny | 307 | // TODO: need to figure out how allow client agents but deny |
259 | // root agents when ACL denies access to root agent | 308 | // root agents when ACL denies access to root agent |
260 | public bool m_strictAccessControl = true; | 309 | public bool m_strictAccessControl = true; |
@@ -298,6 +347,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | protected IUserAccountService m_UserAccountService; | 347 | protected IUserAccountService m_UserAccountService; |
299 | protected IAvatarService m_AvatarService; | 348 | protected IAvatarService m_AvatarService; |
300 | protected IGridUserService m_GridUserService; | 349 | protected IGridUserService m_GridUserService; |
350 | protected IAgentPreferencesService m_AgentPreferencesService; | ||
301 | 351 | ||
302 | protected IXMLRPC m_xmlrpcModule; | 352 | protected IXMLRPC m_xmlrpcModule; |
303 | protected IWorldComm m_worldCommModule; | 353 | protected IWorldComm m_worldCommModule; |
@@ -311,6 +361,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
311 | private Dictionary<string, string> m_extraSettings; | 361 | private Dictionary<string, string> m_extraSettings; |
312 | 362 | ||
313 | /// <summary> | 363 | /// <summary> |
364 | /// If true then the next time the scene loop is activated, updates will be performed by firing of a timer | ||
365 | /// rather than on a single thread that sleeps. | ||
366 | /// </summary> | ||
367 | public bool UpdateOnTimer { get; set; } | ||
368 | |||
369 | /// <summary> | ||
370 | /// Only used if we are updating scene on a timer rather than sleeping a thread. | ||
371 | /// </summary> | ||
372 | private Timer m_sceneUpdateTimer; | ||
373 | |||
374 | /// <summary> | ||
314 | /// Current scene frame number | 375 | /// Current scene frame number |
315 | /// </summary> | 376 | /// </summary> |
316 | public uint Frame | 377 | public uint Frame |
@@ -325,30 +386,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | public uint MaintenanceRun { get; private set; } | 386 | public uint MaintenanceRun { get; private set; } |
326 | 387 | ||
327 | /// <summary> | 388 | /// <summary> |
328 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we | 389 | /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we |
329 | /// will sleep for the remaining period. | 390 | /// will sleep for the remaining period. |
330 | /// </summary> | 391 | /// </summary> |
331 | /// <remarks> | 392 | /// <remarks> |
332 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | 393 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations |
333 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | 394 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). |
334 | /// </remarks> | 395 | /// </remarks> |
335 | public float MinFrameTime { get; private set; } | 396 | public int MinFrameTicks |
397 | { | ||
398 | get { return m_minFrameTicks; } | ||
399 | private set | ||
400 | { | ||
401 | m_minFrameTicks = value; | ||
402 | MinFrameSeconds = (float)m_minFrameTicks / 1000; | ||
403 | } | ||
404 | } | ||
405 | private int m_minFrameTicks; | ||
406 | |||
407 | /// <summary> | ||
408 | /// The minimum length of time in seconds that will be taken for a scene frame. | ||
409 | /// </summary> | ||
410 | /// <remarks> | ||
411 | /// Always derived from MinFrameTicks. | ||
412 | /// </remarks> | ||
413 | public float MinFrameSeconds { get; private set; } | ||
336 | 414 | ||
337 | /// <summary> | 415 | /// <summary> |
338 | /// The minimum length of time in seconds that will be taken for a maintenance run. | 416 | /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we |
417 | /// will sleep for the remaining period. | ||
339 | /// </summary> | 418 | /// </summary> |
340 | public float MinMaintenanceTime { get; private set; } | 419 | /// <remarks> |
420 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | ||
421 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | ||
422 | /// </remarks> | ||
423 | public int MinMaintenanceTicks { get; set; } | ||
341 | 424 | ||
342 | private int m_update_physics = 1; | 425 | private int m_update_physics = 1; |
343 | private int m_update_entitymovement = 1; | 426 | private int m_update_entitymovement = 1; |
344 | private int m_update_objects = 1; | 427 | private int m_update_objects = 1; |
345 | private int m_update_temp_cleaning = 1000; | ||
346 | private int m_update_presences = 1; // Update scene presence movements | 428 | private int m_update_presences = 1; // Update scene presence movements |
347 | private int m_update_events = 1; | 429 | private int m_update_events = 1; |
348 | private int m_update_backup = 200; | 430 | private int m_update_backup = 200; |
431 | <<<<<<< HEAD | ||
432 | private int m_update_terrain = 50; | ||
433 | // private int m_update_land = 1; | ||
434 | ======= | ||
349 | private int m_update_terrain = 1000; | 435 | private int m_update_terrain = 1000; |
350 | private int m_update_land = 10; | 436 | private int m_update_land = 10; |
437 | >>>>>>> avn/ubitvar | ||
351 | private int m_update_coarse_locations = 50; | 438 | private int m_update_coarse_locations = 50; |
439 | private int m_update_temp_cleaning = 180; | ||
352 | 440 | ||
353 | private int agentMS; | 441 | private int agentMS; |
354 | private int frameMS; | 442 | private int frameMS; |
@@ -361,6 +449,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
361 | private int terrainMS; | 449 | private int terrainMS; |
362 | private int landMS; | 450 | private int landMS; |
363 | 451 | ||
452 | // A temporary configuration flag to enable using FireAndForget to process | ||
453 | // collisions from the physics engine. There is a problem with collisions | ||
454 | // stopping sometimes and MB's suspicion is some race condition passing | ||
455 | // collisions from the physics engine callback to the script engine. | ||
456 | // This causes the collision events to be passed with a FireAndForget | ||
457 | // call which should eliminate that linkage. Testers can turn this on | ||
458 | // and see if collisions stop. If they don't, the problem is somewhere else. | ||
459 | // This feature defaults to 'off' so, by default, the simulator operation | ||
460 | // is not changed. | ||
461 | public bool ShouldUseFireAndForgetForCollisions = false; | ||
462 | |||
364 | /// <summary> | 463 | /// <summary> |
365 | /// Tick at which the last frame was processed. | 464 | /// Tick at which the last frame was processed. |
366 | /// </summary> | 465 | /// </summary> |
@@ -373,12 +472,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
373 | private int m_lastMaintenanceTick; | 472 | private int m_lastMaintenanceTick; |
374 | 473 | ||
375 | /// <summary> | 474 | /// <summary> |
475 | /// Total script execution time (in Stopwatch Ticks) since the last frame | ||
476 | /// </summary> | ||
477 | private long m_scriptExecutionTime = 0; | ||
478 | |||
479 | /// <summary> | ||
376 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched | 480 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched |
377 | /// asynchronously from the update loop. | 481 | /// asynchronously from the update loop. |
378 | /// </summary> | 482 | /// </summary> |
379 | private bool m_cleaningTemps = false; | 483 | private bool m_cleaningTemps = false; |
380 | 484 | ||
381 | // private Object m_heartbeatLock = new Object(); | 485 | /// <summary> |
486 | /// Used to control main scene thread looping time when not updating via timer. | ||
487 | /// </summary> | ||
488 | private ManualResetEvent m_updateWaitEvent = new ManualResetEvent(false); | ||
489 | |||
490 | /// <summary> | ||
491 | /// Used to control maintenance thread runs. | ||
492 | /// </summary> | ||
493 | private ManualResetEvent m_maintenanceWaitEvent = new ManualResetEvent(false); | ||
382 | 494 | ||
383 | // TODO: Possibly stop other classes being able to manipulate this directly. | 495 | // TODO: Possibly stop other classes being able to manipulate this directly. |
384 | private SceneGraph m_sceneGraph; | 496 | private SceneGraph m_sceneGraph; |
@@ -389,6 +501,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
389 | 501 | ||
390 | private string m_defaultScriptEngine; | 502 | private string m_defaultScriptEngine; |
391 | 503 | ||
504 | private int m_unixStartTime; | ||
505 | public int UnixStartTime | ||
506 | { | ||
507 | get { return m_unixStartTime; } | ||
508 | } | ||
509 | |||
392 | /// <summary> | 510 | /// <summary> |
393 | /// Tick at which the last login occurred. | 511 | /// Tick at which the last login occurred. |
394 | /// </summary> | 512 | /// </summary> |
@@ -417,7 +535,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
417 | /// Is the scene active? | 535 | /// Is the scene active? |
418 | /// </summary> | 536 | /// </summary> |
419 | /// <remarks> | 537 | /// <remarks> |
420 | /// If false, maintenance and update loops are not being run. Updates can still be triggered manually if | 538 | /// If false, maintenance and update loops are not being run, though after setting to false update may still |
539 | /// be active for a period (and IsRunning will still be true). Updates can still be triggered manually if | ||
421 | /// the scene is not active. | 540 | /// the scene is not active. |
422 | /// </remarks> | 541 | /// </remarks> |
423 | public bool Active | 542 | public bool Active |
@@ -440,6 +559,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
440 | } | 559 | } |
441 | private volatile bool m_active; | 560 | private volatile bool m_active; |
442 | 561 | ||
562 | <<<<<<< HEAD | ||
563 | /// <summary> | ||
564 | /// If true then updates are running. This may be true for a short period after a scene is de-activated. | ||
565 | /// </summary> | ||
566 | public bool IsRunning { get { return m_isRunning; } } | ||
567 | private volatile bool m_isRunning; | ||
568 | ======= | ||
443 | // private int m_lastUpdate; | 569 | // private int m_lastUpdate; |
444 | private bool m_firstHeartbeat = true; | 570 | private bool m_firstHeartbeat = true; |
445 | 571 | ||
@@ -448,6 +574,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
448 | private double m_reprioritizationInterval = 5000.0; | 574 | private double m_reprioritizationInterval = 5000.0; |
449 | private double m_rootReprioritizationDistance = 10.0; | 575 | private double m_rootReprioritizationDistance = 10.0; |
450 | private double m_childReprioritizationDistance = 20.0; | 576 | private double m_childReprioritizationDistance = 20.0; |
577 | >>>>>>> avn/ubitvar | ||
451 | 578 | ||
452 | private Timer m_mapGenerationTimer = new Timer(); | 579 | private Timer m_mapGenerationTimer = new Timer(); |
453 | private bool m_generateMaptiles; | 580 | private bool m_generateMaptiles; |
@@ -468,6 +595,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
468 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 595 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
469 | } | 596 | } |
470 | 597 | ||
598 | public void setThreadCount(int inUseThreads) | ||
599 | { | ||
600 | // Just pass the thread count information on its way as the Scene | ||
601 | // does not require the value for anything at this time | ||
602 | StatsReporter.SetThreadCount(inUseThreads); | ||
603 | } | ||
604 | |||
471 | public SceneCommunicationService SceneGridService | 605 | public SceneCommunicationService SceneGridService |
472 | { | 606 | { |
473 | get { return m_sceneGridService; } | 607 | get { return m_sceneGridService; } |
@@ -539,7 +673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
539 | return m_AssetService; | 673 | return m_AssetService; |
540 | } | 674 | } |
541 | } | 675 | } |
542 | 676 | ||
543 | public IAuthorizationService AuthorizationService | 677 | public IAuthorizationService AuthorizationService |
544 | { | 678 | { |
545 | get | 679 | get |
@@ -667,6 +801,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
667 | } | 801 | } |
668 | } | 802 | } |
669 | 803 | ||
804 | public IAgentPreferencesService AgentPreferencesService | ||
805 | { | ||
806 | get | ||
807 | { | ||
808 | if (m_AgentPreferencesService == null) | ||
809 | m_AgentPreferencesService = RequestModuleInterface<IAgentPreferencesService>(); | ||
810 | return m_AgentPreferencesService; | ||
811 | } | ||
812 | } | ||
813 | |||
670 | public IAttachmentsModule AttachmentsModule { get; set; } | 814 | public IAttachmentsModule AttachmentsModule { get; set; } |
671 | public IEntityTransferModule EntityTransferModule { get; private set; } | 815 | public IEntityTransferModule EntityTransferModule { get; private set; } |
672 | public IAgentAssetTransactions AgentTransactionsModule { get; private set; } | 816 | public IAgentAssetTransactions AgentTransactionsModule { get; private set; } |
@@ -676,7 +820,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
676 | { | 820 | { |
677 | get { return m_AvatarFactory; } | 821 | get { return m_AvatarFactory; } |
678 | } | 822 | } |
679 | 823 | ||
680 | public ICapabilitiesModule CapsModule | 824 | public ICapabilitiesModule CapsModule |
681 | { | 825 | { |
682 | get { return m_capsModule; } | 826 | get { return m_capsModule; } |
@@ -693,11 +837,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
693 | public int MonitorLandTime { get { return landMS; } } | 837 | public int MonitorLandTime { get { return landMS; } } |
694 | public int MonitorLastFrameTick { get { return m_lastFrameTick; } } | 838 | public int MonitorLastFrameTick { get { return m_lastFrameTick; } } |
695 | 839 | ||
696 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } | 840 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; } |
697 | public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } | 841 | public bool IsReprioritizationEnabled { get; set; } |
698 | public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } | 842 | public double ReprioritizationInterval { get; set; } |
699 | public double RootReprioritizationDistance { get { return m_rootReprioritizationDistance; } } | 843 | public double RootReprioritizationDistance { get; set; } |
700 | public double ChildReprioritizationDistance { get { return m_childReprioritizationDistance; } } | 844 | public double ChildReprioritizationDistance { get; set; } |
701 | 845 | ||
702 | public AgentCircuitManager AuthenticateHandler | 846 | public AgentCircuitManager AuthenticateHandler |
703 | { | 847 | { |
@@ -742,18 +886,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
742 | get { return m_sceneGraph.Entities; } | 886 | get { return m_sceneGraph.Entities; } |
743 | } | 887 | } |
744 | 888 | ||
745 | 889 | ||
746 | // used in sequence see: SpawnPoint() | 890 | // used in sequence see: SpawnPoint() |
747 | private int m_SpawnPoint; | 891 | private int m_SpawnPoint; |
748 | // can be closest/random/sequence | 892 | // can be closest/random/sequence |
749 | public string SpawnPointRouting | 893 | public string SpawnPointRouting |
750 | { | 894 | { |
751 | get; private set; | 895 | get; |
896 | private set; | ||
752 | } | 897 | } |
753 | // allow landmarks to pass | 898 | // allow landmarks to pass |
754 | public bool TelehubAllowLandmarks | 899 | public bool TelehubAllowLandmarks |
755 | { | 900 | { |
756 | get; private set; | 901 | get; |
902 | private set; | ||
757 | } | 903 | } |
758 | 904 | ||
759 | #endregion Properties | 905 | #endregion Properties |
@@ -764,11 +910,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | SceneCommunicationService sceneGridService, | 910 | SceneCommunicationService sceneGridService, |
765 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 911 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
766 | IConfigSource config, string simulatorVersion) | 912 | IConfigSource config, string simulatorVersion) |
767 | : this(regInfo) | 913 | : this(regInfo, physicsScene) |
768 | { | 914 | { |
769 | m_config = config; | 915 | m_config = config; |
770 | MinFrameTime = 0.089f; | 916 | MinFrameTicks = 89; |
771 | MinMaintenanceTime = 1; | 917 | MinMaintenanceTicks = 1000; |
772 | SeeIntoRegion = true; | 918 | SeeIntoRegion = true; |
773 | 919 | ||
774 | Random random = new Random(); | 920 | Random random = new Random(); |
@@ -778,9 +924,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
778 | m_sceneGridService = sceneGridService; | 924 | m_sceneGridService = sceneGridService; |
779 | m_SimulationDataService = simDataService; | 925 | m_SimulationDataService = simDataService; |
780 | m_EstateDataService = estateDataService; | 926 | m_EstateDataService = estateDataService; |
927 | <<<<<<< HEAD | ||
928 | ======= | ||
781 | m_regionHandle = RegionInfo.RegionHandle; | 929 | m_regionHandle = RegionInfo.RegionHandle; |
782 | m_lastIncoming = 0; | 930 | m_lastIncoming = 0; |
783 | m_lastOutgoing = 0; | 931 | m_lastOutgoing = 0; |
932 | >>>>>>> avn/ubitvar | ||
784 | 933 | ||
785 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 934 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
786 | m_asyncSceneObjectDeleter.Enabled = true; | 935 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -839,6 +988,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
839 | EventManager.OnLandObjectRemoved += | 988 | EventManager.OnLandObjectRemoved += |
840 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 989 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
841 | 990 | ||
991 | <<<<<<< HEAD | ||
992 | ======= | ||
842 | m_sceneGraph = new SceneGraph(this); | 993 | m_sceneGraph = new SceneGraph(this); |
843 | m_sceneGraph.PhysicsScene = physicsScene; | 994 | m_sceneGraph.PhysicsScene = physicsScene; |
844 | 995 | ||
@@ -855,6 +1006,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | RestartNow(); | 1006 | RestartNow(); |
856 | }; | 1007 | }; |
857 | 1008 | ||
1009 | >>>>>>> avn/ubitvar | ||
858 | RegisterDefaultSceneEvents(); | 1010 | RegisterDefaultSceneEvents(); |
859 | 1011 | ||
860 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled | 1012 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled |
@@ -880,7 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
880 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 1032 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
881 | if (!UseBackup) | 1033 | if (!UseBackup) |
882 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 1034 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
883 | 1035 | ||
884 | //Animation states | 1036 | //Animation states |
885 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 1037 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
886 | 1038 | ||
@@ -940,10 +1092,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
940 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 1092 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
941 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 1093 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
942 | m_dontPersistBefore = | 1094 | m_dontPersistBefore = |
943 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 1095 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
944 | m_dontPersistBefore *= 10000000; | 1096 | m_dontPersistBefore *= 10000000; |
945 | m_persistAfter = | 1097 | m_persistAfter = |
946 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 1098 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
947 | m_persistAfter *= 10000000; | 1099 | m_persistAfter *= 10000000; |
948 | 1100 | ||
949 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 1101 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
@@ -955,12 +1107,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
955 | 1107 | ||
956 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 1108 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
957 | 1109 | ||
958 | m_generateMaptiles | 1110 | m_generateMaptiles |
959 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); | 1111 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
960 | 1112 | ||
961 | if (m_generateMaptiles) | 1113 | if (m_generateMaptiles) |
962 | { | 1114 | { |
963 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 1115 | int maptileRefresh = Util.GetConfigVarFromSections<int>(config, "MaptileRefresh", possibleMapConfigSections, 0); |
1116 | m_log.InfoFormat("[SCENE]: Region {0}, WORLD MAP refresh time set to {1} seconds", RegionInfo.RegionName, maptileRefresh); | ||
964 | if (maptileRefresh != 0) | 1117 | if (maptileRefresh != 0) |
965 | { | 1118 | { |
966 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 1119 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; |
@@ -971,7 +1124,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | } | 1124 | } |
972 | else | 1125 | else |
973 | { | 1126 | { |
974 | string tile | 1127 | string tile |
975 | = Util.GetConfigVarFromSections<string>( | 1128 | = Util.GetConfigVarFromSections<string>( |
976 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | 1129 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); |
977 | 1130 | ||
@@ -990,7 +1143,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
990 | 1143 | ||
991 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | 1144 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; |
992 | 1145 | ||
993 | string grant | 1146 | string grant |
994 | = Util.GetConfigVarFromSections<string>( | 1147 | = Util.GetConfigVarFromSections<string>( |
995 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | 1148 | config, "AllowedClients", possibleAccessControlConfigSections, ""); |
996 | 1149 | ||
@@ -1002,7 +1155,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | } | 1155 | } |
1003 | } | 1156 | } |
1004 | 1157 | ||
1005 | grant | 1158 | grant |
1006 | = Util.GetConfigVarFromSections<string>( | 1159 | = Util.GetConfigVarFromSections<string>( |
1007 | config, "BannedClients", possibleAccessControlConfigSections, ""); | 1160 | config, "BannedClients", possibleAccessControlConfigSections, ""); |
1008 | 1161 | ||
@@ -1014,21 +1167,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1014 | } | 1167 | } |
1015 | } | 1168 | } |
1016 | 1169 | ||
1017 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 1170 | if (startupConfig.Contains("MinFrameTime")) |
1018 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 1171 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); |
1019 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1172 | |
1020 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 1173 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1021 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 1174 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
1022 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 1175 | m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
1023 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 1176 | m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events); |
1024 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 1177 | m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects); |
1025 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 1178 | m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics); |
1026 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 1179 | m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); |
1180 | m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); | ||
1181 | m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); | ||
1182 | |||
1183 | if (startupConfig.Contains("ShouldUseFireAndForgetForCollisions")) | ||
1184 | { | ||
1185 | ShouldUseFireAndForgetForCollisions = startupConfig.GetBoolean("ShouldUseFireAndForgetForCollisions", false); | ||
1186 | } | ||
1027 | } | 1187 | } |
1028 | 1188 | ||
1189 | |||
1029 | // FIXME: Ultimately this should be in a module. | 1190 | // FIXME: Ultimately this should be in a module. |
1030 | SendPeriodicAppearanceUpdates = true; | 1191 | SendPeriodicAppearanceUpdates = false; |
1031 | 1192 | ||
1032 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | 1193 | IConfig appearanceConfig = m_config.Configs["Appearance"]; |
1033 | if (appearanceConfig != null) | 1194 | if (appearanceConfig != null) |
1034 | { | 1195 | { |
@@ -1038,6 +1199,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1038 | 1199 | ||
1039 | #endregion Region Config | 1200 | #endregion Region Config |
1040 | 1201 | ||
1202 | IConfig entityTransferConfig = m_config.Configs["EntityTransfer"]; | ||
1203 | if (entityTransferConfig != null) | ||
1204 | { | ||
1205 | AllowAvatarCrossing = entityTransferConfig.GetBoolean("AllowAvatarCrossing", AllowAvatarCrossing); | ||
1206 | } | ||
1207 | |||
1041 | #region Interest Management | 1208 | #region Interest Management |
1042 | 1209 | ||
1043 | IConfig interestConfig = m_config.Configs["InterestManagement"]; | 1210 | IConfig interestConfig = m_config.Configs["InterestManagement"]; |
@@ -1047,41 +1214,119 @@ namespace OpenSim.Region.Framework.Scenes | |||
1047 | 1214 | ||
1048 | try | 1215 | try |
1049 | { | 1216 | { |
1050 | m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); | 1217 | UpdatePrioritizationScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); |
1051 | } | 1218 | } |
1052 | catch (Exception) | 1219 | catch (Exception) |
1053 | { | 1220 | { |
1054 | m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); | 1221 | m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); |
1055 | m_priorityScheme = UpdatePrioritizationSchemes.Time; | 1222 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; |
1056 | } | 1223 | } |
1057 | 1224 | ||
1058 | m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); | 1225 | IsReprioritizationEnabled |
1059 | m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); | 1226 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); |
1060 | m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); | 1227 | ReprioritizationInterval |
1061 | m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); | 1228 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); |
1229 | RootReprioritizationDistance | ||
1230 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); | ||
1231 | ChildReprioritizationDistance | ||
1232 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); | ||
1233 | |||
1234 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); | ||
1235 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); | ||
1236 | |||
1237 | RootPositionUpdateTolerance | ||
1238 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); | ||
1239 | RootRotationUpdateTolerance | ||
1240 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); | ||
1241 | RootVelocityUpdateTolerance | ||
1242 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); | ||
1062 | } | 1243 | } |
1063 | 1244 | ||
1064 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); | 1245 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); |
1065 | 1246 | ||
1066 | #endregion Interest Management | 1247 | #endregion Interest Management |
1067 | 1248 | ||
1068 | StatsReporter = new SimStatsReporter(this); | 1249 | // The timer used by the Stopwatch class depends on the system hardware and operating system; inform |
1250 | // if the timer is based on a high-resolution performance counter or based on the system timer; | ||
1251 | // the performance counter will provide a more precise time than the system timer | ||
1252 | if (Stopwatch.IsHighResolution) | ||
1253 | m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics."); | ||
1254 | else | ||
1255 | m_log.InfoFormat("[SCENE]: Using system timer for statistics."); | ||
1256 | |||
1257 | // Acquire the statistics section of the OpenSim.ini file located | ||
1258 | // in the bin directory | ||
1259 | IConfig statisticsConfig = m_config.Configs["Statistics"]; | ||
1260 | |||
1261 | // Confirm that the statistics section existed in the configuration | ||
1262 | // file | ||
1263 | if (statisticsConfig != null) | ||
1264 | { | ||
1265 | // Create the StatsReporter using the number of frames to store | ||
1266 | // for the frame time statistics, or 10 frames if the config | ||
1267 | // file doesn't contain a value | ||
1268 | StatsReporter = new SimStatsReporter(this, | ||
1269 | statisticsConfig.GetInt("NumberOfFrames", | ||
1270 | m_defaultNumberFramesStored)); | ||
1271 | } | ||
1272 | else | ||
1273 | { | ||
1274 | // Create a StatsReporter with the current scene and a default | ||
1275 | // 10 frames stored for the frame time statistics | ||
1276 | StatsReporter = new SimStatsReporter(this); | ||
1277 | } | ||
1278 | |||
1069 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1279 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1070 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1280 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1071 | 1281 | ||
1282 | <<<<<<< HEAD | ||
1283 | ======= | ||
1072 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | 1284 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); |
1285 | >>>>>>> avn/ubitvar | ||
1073 | } | 1286 | } |
1074 | 1287 | ||
1075 | public Scene(RegionInfo regInfo) : base(regInfo) | 1288 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) |
1289 | : base(regInfo) | ||
1076 | { | 1290 | { |
1291 | m_sceneGraph = new SceneGraph(this); | ||
1292 | m_sceneGraph.PhysicsScene = physicsScene; | ||
1293 | |||
1294 | // If the scene graph has an Unrecoverable error, restart this sim. | ||
1295 | // Currently the only thing that causes it to happen is two kinds of specific | ||
1296 | // Physics based crashes. | ||
1297 | // | ||
1298 | // Out of memory | ||
1299 | // Operating system has killed the plugin | ||
1300 | m_sceneGraph.UnRecoverableError | ||
1301 | += () => | ||
1302 | { | ||
1303 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
1304 | RestartNow(); | ||
1305 | }; | ||
1306 | |||
1077 | PhysicalPrims = true; | 1307 | PhysicalPrims = true; |
1078 | CollidablePrims = true; | 1308 | CollidablePrims = true; |
1079 | // this is done above acording to config | 1309 | // this is done above acording to config |
1080 | // PhysicsEnabled = true; | 1310 | // PhysicsEnabled = true; |
1081 | 1311 | ||
1312 | AllowAvatarCrossing = true; | ||
1313 | |||
1082 | PeriodicBackup = true; | 1314 | PeriodicBackup = true; |
1083 | UseBackup = true; | 1315 | UseBackup = true; |
1084 | 1316 | ||
1317 | <<<<<<< HEAD | ||
1318 | IsReprioritizationEnabled = true; | ||
1319 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; | ||
1320 | ReprioritizationInterval = 5000; | ||
1321 | |||
1322 | RootRotationUpdateTolerance = 0.1f; | ||
1323 | RootVelocityUpdateTolerance = 0.001f; | ||
1324 | RootPositionUpdateTolerance = 0.05f; | ||
1325 | RootReprioritizationDistance = 10.0; | ||
1326 | ChildReprioritizationDistance = 20.0; | ||
1327 | |||
1328 | ======= | ||
1329 | >>>>>>> avn/ubitvar | ||
1085 | m_eventManager = new EventManager(); | 1330 | m_eventManager = new EventManager(); |
1086 | 1331 | ||
1087 | m_permissions = new ScenePermissions(this); | 1332 | m_permissions = new ScenePermissions(this); |
@@ -1131,7 +1376,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1131 | { | 1376 | { |
1132 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 1377 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
1133 | { | 1378 | { |
1379 | <<<<<<< HEAD | ||
1380 | //// If these are cast to INT because long + negative values + abs returns invalid data | ||
1381 | //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX); | ||
1382 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); | ||
1383 | //if (resultX <= 1 && resultY <= 1) | ||
1384 | float dist = (float)Math.Max(DefaultDrawDistance, | ||
1385 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); | ||
1386 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; | ||
1387 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); | ||
1388 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); | ||
1389 | |||
1390 | //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}", | ||
1391 | // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY); | ||
1392 | |||
1393 | if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY)) | ||
1394 | ======= | ||
1134 | if (isNeighborRegion(otherRegion)) | 1395 | if (isNeighborRegion(otherRegion)) |
1396 | >>>>>>> avn/ubitvar | ||
1135 | { | 1397 | { |
1136 | // Let the grid service module know, so this can be cached | 1398 | // Let the grid service module know, so this can be cached |
1137 | m_eventManager.TriggerOnRegionUp(otherRegion); | 1399 | m_eventManager.TriggerOnRegionUp(otherRegion); |
@@ -1292,14 +1554,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1292 | 1554 | ||
1293 | // Kick all ROOT agents with the message, 'The simulator is going down' | 1555 | // Kick all ROOT agents with the message, 'The simulator is going down' |
1294 | ForEachScenePresence(delegate(ScenePresence avatar) | 1556 | ForEachScenePresence(delegate(ScenePresence avatar) |
1295 | { | 1557 | { |
1296 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); | 1558 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); |
1297 | 1559 | ||
1298 | if (!avatar.IsChildAgent) | 1560 | if (!avatar.IsChildAgent) |
1299 | avatar.ControllingClient.Kick("The simulator is going down."); | 1561 | avatar.ControllingClient.Kick("The simulator is going down."); |
1300 | 1562 | ||
1301 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 1563 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
1302 | }); | 1564 | }); |
1303 | 1565 | ||
1304 | // Stop updating the scene objects and agents. | 1566 | // Stop updating the scene objects and agents. |
1305 | m_shuttingDown = true; | 1567 | m_shuttingDown = true; |
@@ -1352,13 +1614,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1352 | /// </param> | 1614 | /// </param> |
1353 | public void Start(bool startScripts) | 1615 | public void Start(bool startScripts) |
1354 | { | 1616 | { |
1617 | if (IsRunning) | ||
1618 | return; | ||
1619 | |||
1620 | m_isRunning = true; | ||
1355 | m_active = true; | 1621 | m_active = true; |
1356 | 1622 | ||
1623 | m_unixStartTime = Util.UnixTimeSinceEpoch(); | ||
1357 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1624 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1358 | |||
1359 | //m_heartbeatTimer.Enabled = true; | ||
1360 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); | ||
1361 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | ||
1362 | if (m_heartbeatThread != null) | 1625 | if (m_heartbeatThread != null) |
1363 | { | 1626 | { |
1364 | m_hbRestarts++; | 1627 | m_hbRestarts++; |
@@ -1379,14 +1642,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | 1642 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); |
1380 | m_heartbeatThread = null; | 1643 | m_heartbeatThread = null; |
1381 | } | 1644 | } |
1382 | // m_lastUpdate = Util.EnvironmentTickCount(); | ||
1383 | 1645 | ||
1384 | // m_sceneGraph.PreparePhysicsSimulation(); | 1646 | // m_sceneGraph.PreparePhysicsSimulation(); |
1385 | 1647 | ||
1386 | 1648 | ||
1387 | m_heartbeatThread | 1649 | m_heartbeatThread |
1388 | = Watchdog.StartThread( | 1650 | = WorkManager.StartThread( |
1389 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1651 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); |
1390 | 1652 | ||
1391 | StartScripts(); | 1653 | StartScripts(); |
1392 | } | 1654 | } |
@@ -1419,15 +1681,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1419 | /// </summary> | 1681 | /// </summary> |
1420 | private void Heartbeat() | 1682 | private void Heartbeat() |
1421 | { | 1683 | { |
1422 | // if (!Monitor.TryEnter(m_heartbeatLock)) | ||
1423 | // { | ||
1424 | // Watchdog.RemoveThread(); | ||
1425 | // return; | ||
1426 | // } | ||
1427 | |||
1428 | // try | ||
1429 | // { | ||
1430 | |||
1431 | m_eventManager.TriggerOnRegionStarted(this); | 1684 | m_eventManager.TriggerOnRegionStarted(this); |
1432 | 1685 | ||
1433 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, | 1686 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, |
@@ -1435,22 +1688,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
1435 | // alarms for scenes with many objects. | 1688 | // alarms for scenes with many objects. |
1436 | Update(1); | 1689 | Update(1); |
1437 | 1690 | ||
1438 | Watchdog.StartThread( | 1691 | WorkManager.StartThread( |
1439 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); | 1692 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1440 | 1693 | ||
1441 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1694 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1442 | Update(-1); | 1695 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1443 | 1696 | ||
1444 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1697 | if (UpdateOnTimer) |
1445 | // m_firstHeartbeat = false; | 1698 | { |
1446 | // } | 1699 | m_sceneUpdateTimer = new Timer(MinFrameTicks); |
1447 | // finally | 1700 | m_sceneUpdateTimer.AutoReset = true; |
1448 | // { | 1701 | m_sceneUpdateTimer.Elapsed += Update; |
1449 | // Monitor.Pulse(m_heartbeatLock); | 1702 | m_sceneUpdateTimer.Start(); |
1450 | // Monitor.Exit(m_heartbeatLock); | 1703 | } |
1451 | // } | 1704 | else |
1705 | { | ||
1706 | Thread.CurrentThread.Priority = ThreadPriority.Highest; | ||
1707 | Update(-1); | ||
1708 | Watchdog.RemoveThread(); | ||
1709 | m_isRunning = false; | ||
1710 | } | ||
1711 | } | ||
1452 | 1712 | ||
1453 | Watchdog.RemoveThread(); | 1713 | private volatile bool m_isTimerUpdateRunning; |
1714 | |||
1715 | private void Update(object sender, ElapsedEventArgs e) | ||
1716 | { | ||
1717 | if (m_isTimerUpdateRunning) | ||
1718 | return; | ||
1719 | |||
1720 | m_isTimerUpdateRunning = true; | ||
1721 | |||
1722 | // If the last frame did not complete on time, then immediately start the next update on the same thread | ||
1723 | // and ignore further timed updates until we have a frame that had spare time. | ||
1724 | while (!Update(1) && Active) { } | ||
1725 | |||
1726 | if (!Active || m_shuttingDown) | ||
1727 | { | ||
1728 | m_sceneUpdateTimer.Stop(); | ||
1729 | m_sceneUpdateTimer = null; | ||
1730 | m_isRunning = false; | ||
1731 | } | ||
1732 | |||
1733 | m_isTimerUpdateRunning = false; | ||
1454 | } | 1734 | } |
1455 | 1735 | ||
1456 | private void Maintenance() | 1736 | private void Maintenance() |
@@ -1463,7 +1743,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | public void DoMaintenance(int runs) | 1743 | public void DoMaintenance(int runs) |
1464 | { | 1744 | { |
1465 | long? endRun = null; | 1745 | long? endRun = null; |
1466 | int runtc; | 1746 | int runtc, tmpMS; |
1467 | int previousMaintenanceTick; | 1747 | int previousMaintenanceTick; |
1468 | 1748 | ||
1469 | if (runs >= 0) | 1749 | if (runs >= 0) |
@@ -1477,6 +1757,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1477 | runtc = Util.EnvironmentTickCount(); | 1757 | runtc = Util.EnvironmentTickCount(); |
1478 | ++MaintenanceRun; | 1758 | ++MaintenanceRun; |
1479 | 1759 | ||
1760 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); | ||
1761 | |||
1480 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | 1762 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) |
1481 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) | 1763 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) |
1482 | { | 1764 | { |
@@ -1490,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1490 | 1772 | ||
1491 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) | 1773 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) |
1492 | { | 1774 | { |
1493 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); | 1775 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); |
1494 | 1776 | ||
1495 | if (AvatarFactory != null) | 1777 | if (AvatarFactory != null) |
1496 | { | 1778 | { |
@@ -1498,29 +1780,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
1498 | } | 1780 | } |
1499 | } | 1781 | } |
1500 | 1782 | ||
1783 | // Delete temp-on-rez stuff | ||
1784 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) | ||
1785 | { | ||
1786 | // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name); | ||
1787 | tmpMS = Util.EnvironmentTickCount(); | ||
1788 | m_cleaningTemps = true; | ||
1789 | |||
1790 | WorkManager.RunInThread( | ||
1791 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, | ||
1792 | null, | ||
1793 | string.Format("CleanTempObjects ({0})", Name)); | ||
1794 | |||
1795 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1796 | } | ||
1797 | |||
1501 | Watchdog.UpdateThread(); | 1798 | Watchdog.UpdateThread(); |
1502 | 1799 | ||
1503 | previousMaintenanceTick = m_lastMaintenanceTick; | 1800 | previousMaintenanceTick = m_lastMaintenanceTick; |
1504 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); | 1801 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); |
1505 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); | 1802 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); |
1506 | runtc = (int)(MinMaintenanceTime * 1000) - runtc; | 1803 | runtc = MinMaintenanceTicks - runtc; |
1507 | 1804 | ||
1508 | if (runtc > 0) | 1805 | if (runtc > 0) |
1509 | Thread.Sleep(runtc); | 1806 | m_maintenanceWaitEvent.WaitOne(runtc); |
1510 | 1807 | ||
1511 | // Optionally warn if a frame takes double the amount of time that it should. | 1808 | // Optionally warn if a frame takes double the amount of time that it should. |
1512 | if (DebugUpdates | 1809 | if (DebugUpdates |
1513 | && Util.EnvironmentTickCountSubtract( | 1810 | && Util.EnvironmentTickCountSubtract( |
1514 | m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2)) | 1811 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) |
1515 | m_log.WarnFormat( | 1812 | m_log.WarnFormat( |
1516 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", | 1813 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", |
1517 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), | 1814 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), |
1518 | MinMaintenanceTime * 1000, | 1815 | MinMaintenanceTicks, |
1519 | RegionInfo.RegionName); | 1816 | RegionInfo.RegionName); |
1520 | } | 1817 | } |
1521 | } | 1818 | } |
1522 | 1819 | ||
1523 | public override void Update(int frames) | 1820 | public override bool Update(int frames) |
1524 | { | 1821 | { |
1525 | long? endFrame = null; | 1822 | long? endFrame = null; |
1526 | 1823 | ||
@@ -1528,20 +1825,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
1528 | endFrame = Frame + frames; | 1825 | endFrame = Frame + frames; |
1529 | 1826 | ||
1530 | float physicsFPS = 0f; | 1827 | float physicsFPS = 0f; |
1828 | <<<<<<< HEAD | ||
1829 | int previousFrameTick, tmpMS; | ||
1830 | |||
1831 | // These variables will be used to save the precise frame time using the | ||
1832 | // Stopwatch class of Microsoft SDK; the times are recorded at the start | ||
1833 | // and end of a particular section of code, and then used to calculate | ||
1834 | // the frame times, which are the sums of the sections for each given name | ||
1835 | double preciseTotalFrameTime = 0.0; | ||
1836 | double preciseSimFrameTime = 0.0; | ||
1837 | double precisePhysicsFrameTime = 0.0; | ||
1838 | Stopwatch totalFrameStopwatch = new Stopwatch(); | ||
1839 | Stopwatch simFrameStopwatch = new Stopwatch(); | ||
1840 | Stopwatch physicsFrameStopwatch = new Stopwatch(); | ||
1841 | |||
1842 | // Begin the stopwatch to keep track of the time that the frame | ||
1843 | // started running to determine how long the frame took to complete | ||
1844 | totalFrameStopwatch.Start(); | ||
1845 | ======= | ||
1531 | int tmpMS; | 1846 | int tmpMS; |
1532 | int previousFrameTick; | 1847 | int previousFrameTick; |
1533 | int maintc; | 1848 | int maintc; |
1534 | int sleepMS; | 1849 | int sleepMS; |
1535 | int framestart; | 1850 | int framestart; |
1851 | >>>>>>> avn/ubitvar | ||
1536 | 1852 | ||
1537 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1853 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1538 | { | 1854 | { |
1539 | framestart = Util.EnvironmentTickCount(); | 1855 | framestart = Util.EnvironmentTickCount(); |
1540 | ++Frame; | 1856 | ++Frame; |
1541 | 1857 | ||
1542 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1858 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1543 | 1859 | ||
1860 | <<<<<<< HEAD | ||
1861 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | ||
1862 | ======= | ||
1544 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1863 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1864 | >>>>>>> avn/ubitvar | ||
1545 | 1865 | ||
1546 | try | 1866 | try |
1547 | { | 1867 | { |
@@ -1557,52 +1877,112 @@ namespace OpenSim.Region.Framework.Scenes | |||
1557 | 1877 | ||
1558 | if (Frame % m_update_terrain == 0) | 1878 | if (Frame % m_update_terrain == 0) |
1559 | { | 1879 | { |
1880 | <<<<<<< HEAD | ||
1881 | // At several points inside the code there was a need to | ||
1882 | // create a more precise measurement of time elapsed. | ||
1883 | // This led to the addition of variables that have a | ||
1884 | // similar function and thus remain tightly connected to | ||
1885 | // their original counterparts. However, the original | ||
1886 | // code is not receiving comments from our group because | ||
1887 | // we don't feel right modifying the code to that degree | ||
1888 | // at this point in time, the precise values all begin | ||
1889 | // with the keyword precise | ||
1890 | tmpMS = Util.EnvironmentTickCount(); | ||
1891 | simFrameStopwatch.Start(); | ||
1892 | UpdateTerrain(); | ||
1893 | |||
1894 | // Get the simulation frame time that the avatar force | ||
1895 | // input took | ||
1896 | simFrameStopwatch.Stop(); | ||
1897 | preciseSimFrameTime = | ||
1898 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1899 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | ||
1900 | } | ||
1901 | |||
1902 | // At several points inside the code there was a need to | ||
1903 | // create a more precise measurement of time elapsed. This | ||
1904 | // led to the addition of variables that have a similar | ||
1905 | // function and thus remain tightly connected to their | ||
1906 | // original counterparts. However, the original code is | ||
1907 | // not receiving comments from our group because we don't | ||
1908 | // feel right modifying the code to that degree at this | ||
1909 | // point in time, the precise values all begin with the | ||
1910 | // keyword precise | ||
1911 | ======= | ||
1560 | UpdateTerrain(); | 1912 | UpdateTerrain(); |
1561 | } | 1913 | } |
1562 | 1914 | ||
1563 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1915 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1916 | >>>>>>> avn/ubitvar | ||
1564 | 1917 | ||
1565 | tmpMS = Util.EnvironmentTickCount(); | 1918 | tmpMS = Util.EnvironmentTickCount(); |
1919 | |||
1920 | // Begin the stopwatch to track the time to prepare physics | ||
1921 | physicsFrameStopwatch.Start(); | ||
1566 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1922 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1567 | m_sceneGraph.UpdatePreparePhysics(); | 1923 | m_sceneGraph.UpdatePreparePhysics(); |
1924 | |||
1925 | // Get the time it took to prepare the physics, this | ||
1926 | // would report the most precise time that physics was | ||
1927 | // running on the machine and should the physics not be | ||
1928 | // enabled will report the time it took to check if physics | ||
1929 | // was enabled | ||
1930 | physicsFrameStopwatch.Stop(); | ||
1931 | precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1568 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1932 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1569 | 1933 | ||
1570 | // Apply any pending avatar force input to the avatar's velocity | 1934 | // Apply any pending avatar force input to the avatar's velocity |
1571 | tmpMS = Util.EnvironmentTickCount(); | 1935 | tmpMS = Util.EnvironmentTickCount(); |
1936 | simFrameStopwatch.Restart(); | ||
1572 | if (Frame % m_update_entitymovement == 0) | 1937 | if (Frame % m_update_entitymovement == 0) |
1573 | m_sceneGraph.UpdateScenePresenceMovement(); | 1938 | m_sceneGraph.UpdateScenePresenceMovement(); |
1939 | |||
1940 | // Get the simulation frame time that the avatar force input | ||
1941 | // took | ||
1942 | simFrameStopwatch.Stop(); | ||
1943 | preciseSimFrameTime += | ||
1944 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1574 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1945 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1575 | 1946 | ||
1576 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1947 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1577 | // velocity | 1948 | // velocity |
1578 | tmpMS = Util.EnvironmentTickCount(); | 1949 | tmpMS = Util.EnvironmentTickCount(); |
1950 | physicsFrameStopwatch.Restart(); | ||
1579 | if (Frame % m_update_physics == 0) | 1951 | if (Frame % m_update_physics == 0) |
1580 | { | 1952 | { |
1581 | if (PhysicsEnabled) | 1953 | if (PhysicsEnabled) |
1582 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1954 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); |
1583 | 1955 | ||
1584 | if (SynchronizeScene != null) | 1956 | if (SynchronizeScene != null) |
1585 | SynchronizeScene(this); | 1957 | SynchronizeScene(this); |
1586 | } | 1958 | } |
1959 | |||
1960 | // Add the main physics update time to the prepare physics time | ||
1961 | physicsFrameStopwatch.Stop(); | ||
1962 | precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1587 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1963 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1588 | 1964 | ||
1965 | // Start the stopwatch for the remainder of the simulation | ||
1966 | simFrameStopwatch.Restart(); | ||
1589 | tmpMS = Util.EnvironmentTickCount(); | 1967 | tmpMS = Util.EnvironmentTickCount(); |
1590 | 1968 | ||
1591 | // Check if any objects have reached their targets | 1969 | // Check if any objects have reached their targets |
1592 | CheckAtTargets(); | 1970 | CheckAtTargets(); |
1593 | 1971 | ||
1594 | // Update SceneObjectGroups that have scheduled themselves for updates | 1972 | // Update SceneObjectGroups that have scheduled themselves for updates |
1595 | // Objects queue their updates onto all scene presences | 1973 | // Objects queue their updates onto all scene presences |
1596 | if (Frame % m_update_objects == 0) | 1974 | if (Frame % m_update_objects == 0) |
1597 | m_sceneGraph.UpdateObjectGroups(); | 1975 | m_sceneGraph.UpdateObjectGroups(); |
1598 | 1976 | ||
1599 | // Run through all ScenePresences looking for updates | 1977 | // Run through all ScenePresences looking for updates |
1600 | // Presence updates and queued object updates for each presence are sent to clients | 1978 | // Presence updates and queued object updates for each presence are sent to clients |
1601 | if (Frame % m_update_presences == 0) | 1979 | if (Frame % m_update_presences == 0) |
1602 | m_sceneGraph.UpdatePresences(); | 1980 | m_sceneGraph.UpdatePresences(); |
1603 | 1981 | ||
1604 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1982 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1605 | 1983 | ||
1984 | <<<<<<< HEAD | ||
1985 | ======= | ||
1606 | 1986 | ||
1607 | // Delete temp-on-rez stuff | 1987 | // Delete temp-on-rez stuff |
1608 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1988 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1613,31 +1993,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1613 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1993 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1614 | } | 1994 | } |
1615 | 1995 | ||
1996 | >>>>>>> avn/ubitvar | ||
1616 | if (Frame % m_update_events == 0) | 1997 | if (Frame % m_update_events == 0) |
1617 | { | 1998 | { |
1618 | tmpMS = Util.EnvironmentTickCount(); | 1999 | tmpMS = Util.EnvironmentTickCount(); |
1619 | UpdateEvents(); | 2000 | UpdateEvents(); |
1620 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 2001 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1621 | } | 2002 | } |
1622 | 2003 | ||
1623 | if (PeriodicBackup && Frame % m_update_backup == 0) | 2004 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1624 | { | 2005 | { |
1625 | tmpMS = Util.EnvironmentTickCount(); | 2006 | tmpMS = Util.EnvironmentTickCount(); |
1626 | UpdateStorageBackup(); | 2007 | UpdateStorageBackup(); |
1627 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); | 2008 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1628 | } | 2009 | } |
1629 | 2010 | ||
1630 | //if (Frame % m_update_land == 0) | 2011 | //if (Frame % m_update_land == 0) |
1631 | //{ | 2012 | //{ |
1632 | // int ldMS = Util.EnvironmentTickCount(); | 2013 | // int ldMS = Util.EnvironmentTickCount(); |
1633 | // UpdateLand(); | 2014 | // UpdateLand(); |
1634 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 2015 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1635 | //} | 2016 | //} |
1636 | 2017 | ||
1637 | if (!LoginsEnabled && Frame == 20) | 2018 | if (!LoginsEnabled && Frame == 20) |
1638 | { | 2019 | { |
1639 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); | 2020 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); |
1640 | 2021 | ||
1641 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 2022 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, |
1642 | // this is a rare case where we know we have just went through a long cycle of heap | 2023 | // this is a rare case where we know we have just went through a long cycle of heap |
1643 | // allocations, and there is no more work to be done until someone logs in | 2024 | // allocations, and there is no more work to be done until someone logs in |
@@ -1652,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1652 | } | 2033 | } |
1653 | 2034 | ||
1654 | m_sceneGridService.InformNeighborsThatRegionisUp( | 2035 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1655 | RequestModuleInterface<INeighbourService>(), RegionInfo); | 2036 | RequestModuleInterface<INeighbourService>(), RegionInfo); |
1656 | 2037 | ||
1657 | // Region ready should always be set | 2038 | // Region ready should always be set |
1658 | Ready = true; | 2039 | Ready = true; |
@@ -1663,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1663 | if (m_sceneGraph.GetActiveScriptsCount() == 0) | 2044 | if (m_sceneGraph.GetActiveScriptsCount() == 0) |
1664 | { | 2045 | { |
1665 | // In this case, we leave it to the IRegionReadyModule to enable logins | 2046 | // In this case, we leave it to the IRegionReadyModule to enable logins |
1666 | 2047 | ||
1667 | // LoginLock can currently only be set by a region module implementation. | 2048 | // LoginLock can currently only be set by a region module implementation. |
1668 | // If somehow this hasn't been done then the quickest way to bugfix is to see the | 2049 | // If somehow this hasn't been done then the quickest way to bugfix is to see the |
1669 | // NullReferenceException | 2050 | // NullReferenceException |
@@ -1679,11 +2060,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
1679 | "[SCENE]: Failed on region {0} with exception {1}{2}", | 2060 | "[SCENE]: Failed on region {0} with exception {1}{2}", |
1680 | RegionInfo.RegionName, e.Message, e.StackTrace); | 2061 | RegionInfo.RegionName, e.Message, e.StackTrace); |
1681 | } | 2062 | } |
1682 | 2063 | ||
1683 | EventManager.TriggerRegionHeartbeatEnd(this); | 2064 | EventManager.TriggerRegionHeartbeatEnd(this); |
2065 | otherMS = eventMS + backupMS + terrainMS + landMS; | ||
1684 | 2066 | ||
1685 | Watchdog.UpdateThread(); | 2067 | // Get the elapsed time for the simulation frame |
2068 | simFrameStopwatch.Stop(); | ||
2069 | preciseSimFrameTime += | ||
2070 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1686 | 2071 | ||
2072 | <<<<<<< HEAD | ||
2073 | if (!UpdateOnTimer) | ||
2074 | { | ||
2075 | Watchdog.UpdateThread(); | ||
2076 | |||
2077 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); | ||
2078 | |||
2079 | if (spareMS > 0) | ||
2080 | m_updateWaitEvent.WaitOne(spareMS); | ||
2081 | else | ||
2082 | spareMS = 0; | ||
2083 | } | ||
2084 | else | ||
2085 | { | ||
2086 | spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS); | ||
2087 | } | ||
2088 | |||
2089 | // Get the total frame time | ||
2090 | totalFrameStopwatch.Stop(); | ||
2091 | preciseTotalFrameTime = | ||
2092 | totalFrameStopwatch.Elapsed.TotalMilliseconds; | ||
2093 | |||
2094 | // Restart the stopwatch for the total time of the next frame | ||
2095 | totalFrameStopwatch.Restart(); | ||
2096 | |||
2097 | previousFrameTick = m_lastFrameTick; | ||
2098 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | ||
2099 | m_lastFrameTick = Util.EnvironmentTickCount(); | ||
2100 | ======= | ||
1687 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 2101 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
1688 | 2102 | ||
1689 | StatsReporter.AddPhysicsFPS(physicsFPS); | 2103 | StatsReporter.AddPhysicsFPS(physicsFPS); |
@@ -1711,22 +2125,67 @@ namespace OpenSim.Region.Framework.Scenes | |||
1711 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | 2125 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1712 | StatsReporter.addSleepMS(sleepMS); | 2126 | StatsReporter.addSleepMS(sleepMS); |
1713 | StatsReporter.addFrameMS(frameMS); | 2127 | StatsReporter.addFrameMS(frameMS); |
2128 | >>>>>>> avn/ubitvar | ||
1714 | 2129 | ||
1715 | // if (Frame%m_update_avatars == 0) | 2130 | // if (Frame%m_update_avatars == 0) |
1716 | // UpdateInWorldTime(); | 2131 | // UpdateInWorldTime(); |
1717 | 2132 | ||
2133 | <<<<<<< HEAD | ||
2134 | StatsReporter.addFrameMS(frameMS); | ||
2135 | StatsReporter.addAgentMS(agentMS); | ||
2136 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
2137 | StatsReporter.addOtherMS(otherMS); | ||
2138 | StatsReporter.AddSpareMS(spareMS); | ||
2139 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
2140 | StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime()); | ||
2141 | ======= | ||
2142 | >>>>>>> avn/ubitvar | ||
2143 | |||
2144 | // Send the correct time values to the stats reporter for the | ||
2145 | // frame times | ||
2146 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, | ||
2147 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); | ||
1718 | 2148 | ||
1719 | // Optionally warn if a frame takes double the amount of time that it should. | 2149 | // Send the correct number of frames that the physics library |
2150 | // has processed to the stats reporter | ||
2151 | StatsReporter.addPhysicsFrame(1); | ||
2152 | |||
2153 | // Optionally warn if a frame takes double the amount of time that it should. | ||
1720 | if (DebugUpdates | 2154 | if (DebugUpdates |
1721 | && Util.EnvironmentTickCountSubtract( | 2155 | && Util.EnvironmentTickCountSubtract( |
1722 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 2156 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) |
1723 | m_log.WarnFormat( | 2157 | m_log.WarnFormat( |
1724 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 2158 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1725 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 2159 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1726 | MinFrameTime * 1000, | 2160 | MinFrameTicks, |
1727 | RegionInfo.RegionName); | 2161 | RegionInfo.RegionName); |
1728 | } | 2162 | } |
1729 | } | 2163 | |
2164 | // Finished updating scene frame, so stop the total frame's Stopwatch | ||
2165 | totalFrameStopwatch.Stop(); | ||
2166 | |||
2167 | return spareMS >= 0; | ||
2168 | } | ||
2169 | |||
2170 | /// <summary> | ||
2171 | /// Adds the execution time of one script to the total scripts execution time for this region. | ||
2172 | /// </summary> | ||
2173 | /// <param name="ticks">Elapsed Stopwatch ticks</param> | ||
2174 | public void AddScriptExecutionTime(long ticks) | ||
2175 | { | ||
2176 | Interlocked.Add(ref m_scriptExecutionTime, ticks); | ||
2177 | } | ||
2178 | |||
2179 | /// <summary> | ||
2180 | /// Returns the total execution time of all the scripts in the region since the last frame | ||
2181 | /// (in milliseconds), and clears the value in preparation for the next frame. | ||
2182 | /// </summary> | ||
2183 | /// <returns>Time in milliseconds</returns> | ||
2184 | private long GetAndResetScriptExecutionTime() | ||
2185 | { | ||
2186 | long ticks = Interlocked.Exchange(ref m_scriptExecutionTime, 0); | ||
2187 | return (ticks * 1000) / Stopwatch.Frequency; | ||
2188 | } | ||
1730 | 2189 | ||
1731 | public void AddGroupTarget(SceneObjectGroup grp) | 2190 | public void AddGroupTarget(SceneObjectGroup grp) |
1732 | { | 2191 | { |
@@ -1796,7 +2255,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1796 | if (!m_backingup) | 2255 | if (!m_backingup) |
1797 | { | 2256 | { |
1798 | m_backingup = true; | 2257 | m_backingup = true; |
1799 | Util.FireAndForget(BackupWaitCallback); | 2258 | WorkManager.RunInThread(o => Backup(false), null, string.Format("BackupWaitCallback ({0})", Name)); |
1800 | } | 2259 | } |
1801 | } | 2260 | } |
1802 | 2261 | ||
@@ -1809,16 +2268,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1809 | } | 2268 | } |
1810 | 2269 | ||
1811 | /// <summary> | 2270 | /// <summary> |
1812 | /// Wrapper for Backup() that can be called with Util.FireAndForget() | 2271 | /// Backup the scene. |
1813 | /// </summary> | ||
1814 | private void BackupWaitCallback(object o) | ||
1815 | { | ||
1816 | Backup(false); | ||
1817 | } | ||
1818 | |||
1819 | /// <summary> | ||
1820 | /// Backup the scene. This acts as the main method of the backup thread. | ||
1821 | /// </summary> | 2272 | /// </summary> |
2273 | /// <remarks> | ||
2274 | /// This acts as the main method of the backup thread. In a regression test whether the backup thread is not | ||
2275 | /// running independently this can be invoked directly. | ||
2276 | /// </remarks> | ||
1822 | /// <param name="forced"> | 2277 | /// <param name="forced"> |
1823 | /// If true, then any changes that have not yet been persisted are persisted. If false, | 2278 | /// If true, then any changes that have not yet been persisted are persisted. If false, |
1824 | /// then the persistence decision is left to the backup code (in some situations, such as object persistence, | 2279 | /// then the persistence decision is left to the backup code (in some situations, such as object persistence, |
@@ -1857,7 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1857 | 2312 | ||
1858 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); | 2313 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); |
1859 | if (tr != null) | 2314 | if (tr != null) |
1860 | tr.SendInstantMessage(msg, delegate(bool success) {}); | 2315 | tr.SendInstantMessage(msg, delegate(bool success) { }); |
1861 | } | 2316 | } |
1862 | m_returns.Clear(); | 2317 | m_returns.Clear(); |
1863 | } | 2318 | } |
@@ -1871,6 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1871 | { | 2326 | { |
1872 | if (group != null) | 2327 | if (group != null) |
1873 | { | 2328 | { |
2329 | group.HasGroupChanged = true; | ||
1874 | group.ProcessBackup(SimulationDataService, true); | 2330 | group.ProcessBackup(SimulationDataService, true); |
1875 | } | 2331 | } |
1876 | } | 2332 | } |
@@ -1964,9 +2420,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1964 | m_log.WarnFormat( | 2420 | m_log.WarnFormat( |
1965 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", | 2421 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", |
1966 | e.Message, e.StackTrace); | 2422 | e.Message, e.StackTrace); |
1967 | 2423 | ||
1968 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer | 2424 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer |
1969 | #pragma warning disable 0162 | 2425 | #pragma warning disable 0162 |
1970 | if ((int)Constants.RegionSize != 256) | 2426 | if ((int)Constants.RegionSize != 256) |
1971 | { | 2427 | { |
1972 | Heightmap = new TerrainChannel(); | 2428 | Heightmap = new TerrainChannel(); |
@@ -1994,15 +2450,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1994 | //// stored in the GridService, because that's what the world map module uses | 2450 | //// stored in the GridService, because that's what the world map module uses |
1995 | //// to send the map image UUIDs (of other regions) to the viewer... | 2451 | //// to send the map image UUIDs (of other regions) to the viewer... |
1996 | if (m_generateMaptiles) | 2452 | if (m_generateMaptiles) |
1997 | RegenerateMaptile(); | 2453 | RegenerateMaptile(); |
1998 | 2454 | ||
1999 | GridRegion region = new GridRegion(RegionInfo); | 2455 | GridRegion region = new GridRegion(RegionInfo); |
2000 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 2456 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
2001 | m_log.DebugFormat("{0} RegisterRegionWithGrid. name={1},id={2},loc=<{3},{4}>,size=<{5},{6}>", | 2457 | // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>", |
2002 | LogHeader, m_regionName, | 2458 | // m_regionName, |
2003 | RegionInfo.RegionID, | 2459 | // RegionInfo.RegionID, |
2004 | RegionInfo.RegionLocX, RegionInfo.RegionLocY, | 2460 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, |
2005 | RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 2461 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
2462 | |||
2006 | if (error != String.Empty) | 2463 | if (error != String.Empty) |
2007 | throw new Exception(error); | 2464 | throw new Exception(error); |
2008 | } | 2465 | } |
@@ -2063,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2063 | rootPart.TrimPermissions(); | 2520 | rootPart.TrimPermissions(); |
2064 | 2521 | ||
2065 | // Don't do this here - it will get done later on when sculpt data is loaded. | 2522 | // Don't do this here - it will get done later on when sculpt data is loaded. |
2066 | // group.CheckSculptAndLoad(); | 2523 | // group.CheckSculptAndLoad(); |
2067 | } | 2524 | } |
2068 | 2525 | ||
2069 | LoadingPrims = false; | 2526 | LoadingPrims = false; |
@@ -2081,7 +2538,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2081 | { | 2538 | { |
2082 | if (PhysicsScene == null) | 2539 | if (PhysicsScene == null) |
2083 | return null; | 2540 | return null; |
2084 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | 2541 | return PhysicsScene.RaycastWorld(position, direction, length, Count, filter); |
2085 | } | 2542 | } |
2086 | 2543 | ||
2087 | /// <summary> | 2544 | /// <summary> |
@@ -2121,8 +2578,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2121 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2578 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2122 | 2579 | ||
2123 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); | 2580 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); |
2124 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 2581 | Vector3 AXOrigin = RayStart; |
2125 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 2582 | Vector3 AXdirection = direction; |
2126 | 2583 | ||
2127 | if (target != null) | 2584 | if (target != null) |
2128 | { | 2585 | { |
@@ -2144,13 +2601,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2144 | // If we hit something | 2601 | // If we hit something |
2145 | if (ei.HitTF) | 2602 | if (ei.HitTF) |
2146 | { | 2603 | { |
2147 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 2604 | Vector3 scaleComponent = ei.AAfaceNormal; |
2148 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 2605 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
2149 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 2606 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
2150 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 2607 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
2151 | ScaleOffset = Math.Abs(ScaleOffset); | 2608 | ScaleOffset = Math.Abs(ScaleOffset); |
2152 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2609 | Vector3 intersectionpoint = ei.ipoint; |
2153 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 2610 | Vector3 normal = ei.normal; |
2154 | // Set the position to the intersection point | 2611 | // Set the position to the intersection point |
2155 | Vector3 offset = (normal * (ScaleOffset / 2f)); | 2612 | Vector3 offset = (normal * (ScaleOffset / 2f)); |
2156 | pos = (intersectionpoint + offset); | 2613 | pos = (intersectionpoint + offset); |
@@ -2159,7 +2616,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2159 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method | 2616 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method |
2160 | // Un-offset the prim (it gets offset later by the consumer method) | 2617 | // Un-offset the prim (it gets offset later by the consumer method) |
2161 | //pos.Z -= 0.25F; | 2618 | //pos.Z -= 0.25F; |
2162 | 2619 | ||
2163 | } | 2620 | } |
2164 | } | 2621 | } |
2165 | else | 2622 | else |
@@ -2172,8 +2629,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2172 | 2629 | ||
2173 | if (ei.HitTF) | 2630 | if (ei.HitTF) |
2174 | { | 2631 | { |
2632 | <<<<<<< HEAD | ||
2633 | pos = ei.ipoint; | ||
2634 | } | ||
2635 | ======= | ||
2175 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2636 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2176 | } | 2637 | } |
2638 | >>>>>>> avn/ubitvar | ||
2177 | else | 2639 | else |
2178 | { | 2640 | { |
2179 | // fall back to our stupid functionality | 2641 | // fall back to our stupid functionality |
@@ -2238,7 +2700,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2238 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); | 2700 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); |
2239 | 2701 | ||
2240 | SceneObjectGroup sceneObject = null; | 2702 | SceneObjectGroup sceneObject = null; |
2241 | 2703 | ||
2242 | // If an entity creator has been registered for this prim type then use that | 2704 | // If an entity creator has been registered for this prim type then use that |
2243 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) | 2705 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) |
2244 | { | 2706 | { |
@@ -2259,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2259 | 2721 | ||
2260 | return sceneObject; | 2722 | return sceneObject; |
2261 | } | 2723 | } |
2262 | 2724 | ||
2263 | /// <summary> | 2725 | /// <summary> |
2264 | /// Add an object into the scene that has come from storage | 2726 | /// Add an object into the scene that has come from storage |
2265 | /// </summary> | 2727 | /// </summary> |
@@ -2292,7 +2754,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2292 | 2754 | ||
2293 | return false; | 2755 | return false; |
2294 | } | 2756 | } |
2295 | 2757 | ||
2296 | /// <summary> | 2758 | /// <summary> |
2297 | /// Add an object into the scene that has come from storage | 2759 | /// Add an object into the scene that has come from storage |
2298 | /// </summary> | 2760 | /// </summary> |
@@ -2328,7 +2790,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2328 | { | 2790 | { |
2329 | return AddNewSceneObject(sceneObject, attachToBackup, true); | 2791 | return AddNewSceneObject(sceneObject, attachToBackup, true); |
2330 | } | 2792 | } |
2331 | 2793 | ||
2332 | /// <summary> | 2794 | /// <summary> |
2333 | /// Add a newly created object to the scene | 2795 | /// Add a newly created object to the scene |
2334 | /// </summary> | 2796 | /// </summary> |
@@ -2343,16 +2805,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2343 | /// </param> | 2805 | /// </param> |
2344 | /// <returns>true if the object was added. false if not</returns> | 2806 | /// <returns>true if the object was added. false if not</returns> |
2345 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2807 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2346 | { | 2808 | { |
2347 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) | 2809 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
2348 | { | 2810 | { |
2349 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2811 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2350 | return true; | 2812 | return true; |
2351 | } | 2813 | } |
2352 | 2814 | ||
2353 | return false; | 2815 | return false; |
2354 | } | 2816 | } |
2355 | 2817 | ||
2356 | /// <summary> | 2818 | /// <summary> |
2357 | /// Add a newly created object to the scene. | 2819 | /// Add a newly created object to the scene. |
2358 | /// </summary> | 2820 | /// </summary> |
@@ -2369,7 +2831,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2369 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) | 2831 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
2370 | { | 2832 | { |
2371 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 2833 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
2372 | { | 2834 | { |
2373 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2835 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2374 | return true; | 2836 | return true; |
2375 | } | 2837 | } |
@@ -2439,8 +2901,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2439 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 2901 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
2440 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> | 2902 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> |
2441 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) | 2903 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) |
2442 | { | 2904 | { |
2443 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | 2905 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); |
2444 | 2906 | ||
2445 | if (removeScripts) | 2907 | if (removeScripts) |
2446 | group.RemoveScriptInstances(true); | 2908 | group.RemoveScriptInstances(true); |
@@ -2485,7 +2947,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2485 | if (!silent) | 2947 | if (!silent) |
2486 | SendKillObject(new List<uint>() { group.LocalId }); | 2948 | SendKillObject(new List<uint>() { group.LocalId }); |
2487 | 2949 | ||
2488 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2950 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2489 | } | 2951 | } |
2490 | 2952 | ||
2491 | /// <summary> | 2953 | /// <summary> |
@@ -2501,17 +2963,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2501 | { | 2963 | { |
2502 | if (!softDelete) | 2964 | if (!softDelete) |
2503 | { | 2965 | { |
2504 | // Force a database update so that the scene object group ID is accurate. It's possible that the | 2966 | // If the group contains prims whose SceneGroupID is incorrect then force a |
2505 | // group has recently been delinked from another group but that this change has not been persisted | 2967 | // database update, because RemoveObject() works by searching on the SceneGroupID. |
2506 | // to the DB. | ||
2507 | // This is an expensive thing to do so only do it if absolutely necessary. | 2968 | // This is an expensive thing to do so only do it if absolutely necessary. |
2508 | if (so.HasGroupChangedDueToDelink) | 2969 | if (so.GroupContainsForeignPrims) |
2509 | ForceSceneObjectBackup(so); | 2970 | ForceSceneObjectBackup(so); |
2510 | 2971 | ||
2511 | so.DetachFromBackup(); | 2972 | so.DetachFromBackup(); |
2512 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); | 2973 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); |
2513 | } | 2974 | } |
2514 | 2975 | ||
2515 | // We need to keep track of this state in case this group is still queued for further backup. | 2976 | // We need to keep track of this state in case this group is still queued for further backup. |
2516 | so.IsDeleted = true; | 2977 | so.IsDeleted = true; |
2517 | 2978 | ||
@@ -2552,6 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2552 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); | 3013 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); |
2553 | } | 3014 | } |
2554 | return; | 3015 | return; |
3016 | <<<<<<< HEAD | ||
3017 | ======= | ||
2555 | } | 3018 | } |
2556 | 3019 | ||
2557 | if (grp.RootPart.RETURN_AT_EDGE) | 3020 | if (grp.RootPart.RETURN_AT_EDGE) |
@@ -2593,6 +3056,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
2593 | // Regular region. Just check for region size | 3056 | // Regular region. Just check for region size |
2594 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | 3057 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) |
2595 | ret = true; | 3058 | ret = true; |
3059 | >>>>>>> avn/ubitvar | ||
3060 | } | ||
3061 | |||
3062 | if (grp.RootPart.RETURN_AT_EDGE) | ||
3063 | { | ||
3064 | <<<<<<< HEAD | ||
3065 | // We remove the object here | ||
3066 | try | ||
3067 | { | ||
3068 | List<SceneObjectGroup> objects = new List<SceneObjectGroup>(); | ||
3069 | objects.Add(grp); | ||
3070 | SceneObjectGroup[] objectsArray = objects.ToArray(); | ||
3071 | returnObjects(objectsArray, UUID.Zero); | ||
3072 | } | ||
3073 | catch (Exception) | ||
3074 | { | ||
3075 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); | ||
3076 | } | ||
3077 | return; | ||
3078 | } | ||
3079 | |||
3080 | if (EntityTransferModule != null) | ||
3081 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | ||
3082 | } | ||
3083 | |||
3084 | // Simple test to see if a position is in the current region. | ||
3085 | // This test is mostly used to see if a region crossing is necessary. | ||
3086 | // Assuming the position is relative to the region so anything outside its bounds. | ||
3087 | // Return 'true' if position inside region. | ||
3088 | public bool PositionIsInCurrentRegion(Vector3 pos) | ||
3089 | { | ||
3090 | bool ret = false; | ||
3091 | int xx = (int)Math.Floor(pos.X); | ||
3092 | int yy = (int)Math.Floor(pos.Y); | ||
3093 | if (xx < 0 || yy < 0) | ||
3094 | return false; | ||
3095 | |||
3096 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | ||
3097 | if (regionCombinerModule == null) | ||
3098 | { | ||
3099 | // Regular region. Just check for region size | ||
3100 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY) | ||
3101 | ret = true; | ||
2596 | } | 3102 | } |
2597 | else | 3103 | else |
2598 | { | 3104 | { |
@@ -2604,6 +3110,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2604 | 3110 | ||
2605 | } | 3111 | } |
2606 | 3112 | ||
3113 | ======= | ||
3114 | // We're in a mega-region so see if we are still in that larger region | ||
3115 | ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); | ||
3116 | } | ||
3117 | |||
3118 | return ret; | ||
3119 | |||
3120 | } | ||
3121 | |||
3122 | >>>>>>> avn/ubitvar | ||
2607 | /// <summary> | 3123 | /// <summary> |
2608 | /// Called when objects or attachments cross the border, or teleport, between regions. | 3124 | /// Called when objects or attachments cross the border, or teleport, between regions. |
2609 | /// </summary> | 3125 | /// </summary> |
@@ -2625,6 +3141,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2625 | return false; | 3141 | return false; |
2626 | } | 3142 | } |
2627 | 3143 | ||
3144 | <<<<<<< HEAD | ||
3145 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) | ||
3146 | return false; | ||
3147 | ======= | ||
2628 | // If the user is banned, we won't let any of their objects | 3148 | // If the user is banned, we won't let any of their objects |
2629 | // enter. Period. | 3149 | // enter. Period. |
2630 | // | 3150 | // |
@@ -2669,6 +3189,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2669 | //if (newObject.RootPart.KeyframeMotion != null) | 3189 | //if (newObject.RootPart.KeyframeMotion != null) |
2670 | // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | 3190 | // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); |
2671 | } | 3191 | } |
3192 | >>>>>>> avn/ubitvar | ||
2672 | 3193 | ||
2673 | // Do this as late as possible so that listeners have full access to the incoming object | 3194 | // Do this as late as possible so that listeners have full access to the incoming object |
2674 | EventManager.TriggerOnIncomingSceneObject(newObject); | 3195 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2712,7 +3233,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2712 | { | 3233 | { |
2713 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 3234 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2714 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 3235 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2715 | 3236 | ||
2716 | // Don't sent a full update here because this will cause full updates to be sent twice for | 3237 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2717 | // attachments on region crossings, resulting in viewer glitches. | 3238 | // attachments on region crossings, resulting in viewer glitches. |
2718 | AddRestoredSceneObject(sceneObject, false, false, false); | 3239 | AddRestoredSceneObject(sceneObject, false, false, false); |
@@ -2727,10 +3248,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2727 | { | 3248 | { |
2728 | SceneObjectGroup grp = sceneObject; | 3249 | SceneObjectGroup grp = sceneObject; |
2729 | 3250 | ||
2730 | // m_log.DebugFormat( | 3251 | // m_log.DebugFormat( |
2731 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 3252 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2732 | // m_log.DebugFormat( | 3253 | // m_log.DebugFormat( |
2733 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 3254 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2734 | 3255 | ||
2735 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 3256 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2736 | 3257 | ||
@@ -2765,6 +3286,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2765 | return true; | 3286 | return true; |
2766 | } | 3287 | } |
2767 | 3288 | ||
3289 | <<<<<<< HEAD | ||
3290 | ======= | ||
2768 | private int GetStateSource(SceneObjectGroup sog) | 3291 | private int GetStateSource(SceneObjectGroup sog) |
2769 | { | 3292 | { |
2770 | ScenePresence sp = GetScenePresence(sog.OwnerID); | 3293 | ScenePresence sp = GetScenePresence(sog.OwnerID); |
@@ -2793,6 +3316,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2793 | return uac.UserFlags; | 3316 | return uac.UserFlags; |
2794 | //} | 3317 | //} |
2795 | } | 3318 | } |
3319 | >>>>>>> avn/ubitvar | ||
2796 | #endregion | 3320 | #endregion |
2797 | 3321 | ||
2798 | #region Add/Remove Avatar Methods | 3322 | #region Add/Remove Avatar Methods |
@@ -2803,6 +3327,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2803 | bool vialogin; | 3327 | bool vialogin; |
2804 | bool reallyNew = true; | 3328 | bool reallyNew = true; |
2805 | 3329 | ||
3330 | // Update the number of users attempting to login | ||
3331 | StatsReporter.UpdateUsersLoggingIn(true); | ||
3332 | |||
2806 | // Validation occurs in LLUDPServer | 3333 | // Validation occurs in LLUDPServer |
2807 | // | 3334 | // |
2808 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with | 3335 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with |
@@ -2825,9 +3352,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2825 | vialogin | 3352 | vialogin |
2826 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 3353 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2827 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 3354 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
3355 | <<<<<<< HEAD | ||
3356 | |||
3357 | // CheckHeartbeat(); | ||
3358 | |||
3359 | ======= | ||
2828 | 3360 | ||
2829 | CheckHeartbeat(); | 3361 | CheckHeartbeat(); |
2830 | 3362 | ||
3363 | >>>>>>> avn/ubitvar | ||
2831 | sp = GetScenePresence(client.AgentId); | 3364 | sp = GetScenePresence(client.AgentId); |
2832 | 3365 | ||
2833 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this | 3366 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this |
@@ -2837,6 +3370,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
2837 | if (sp == null) | 3370 | if (sp == null) |
2838 | { | 3371 | { |
2839 | m_log.DebugFormat( | 3372 | m_log.DebugFormat( |
3373 | <<<<<<< HEAD | ||
3374 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | ||
3375 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | ||
3376 | |||
3377 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | ||
3378 | |||
3379 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
3380 | // client is for a root or child agent. | ||
3381 | // We must also set this before adding the client to the client manager so that an exception later on | ||
3382 | // does not leave a client manager entry without the scene agent set, which will cause other code | ||
3383 | // to fail since any entry in the client manager should have a ScenePresence | ||
3384 | // | ||
3385 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
3386 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
3387 | // actually occurs). | ||
3388 | client.SceneAgent = sp; | ||
3389 | |||
3390 | m_clientManager.Add(client); | ||
3391 | SubscribeToClientEvents(client); | ||
3392 | m_eventManager.TriggerOnNewPresence(sp); | ||
3393 | |||
3394 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | ||
3395 | ======= | ||
2840 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", | 3396 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", |
2841 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, | 3397 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, |
2842 | ((TPFlags)aCircuit.teleportFlags).ToString()); | 3398 | ((TPFlags)aCircuit.teleportFlags).ToString()); |
@@ -2859,34 +3415,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
2859 | */ | 3415 | */ |
2860 | m_eventManager.TriggerOnNewPresence(sp); | 3416 | m_eventManager.TriggerOnNewPresence(sp); |
2861 | 3417 | ||
3418 | >>>>>>> avn/ubitvar | ||
2862 | } | 3419 | } |
2863 | else | 3420 | else |
2864 | { | 3421 | { |
3422 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
3423 | // client is for a root or child agent. | ||
3424 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
3425 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
3426 | // actually occurs). | ||
3427 | client.SceneAgent = sp; | ||
3428 | |||
2865 | m_log.WarnFormat( | 3429 | m_log.WarnFormat( |
2866 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 3430 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", |
2867 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 3431 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
3432 | |||
2868 | reallyNew = false; | 3433 | reallyNew = false; |
2869 | } | 3434 | } |
2870 | |||
2871 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
2872 | // client is for a root or child agent. | ||
2873 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
2874 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
2875 | // actually occurs). | ||
2876 | client.SceneAgent = sp; | ||
2877 | 3435 | ||
2878 | // This is currently also being done earlier in NewUserConnection for real users to see if this | 3436 | // This is currently also being done earlier in NewUserConnection for real users to see if this |
2879 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other | 3437 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other |
2880 | // places. However, we still need to do it here for NPCs. | 3438 | // places. However, we still need to do it here for NPCs. |
2881 | CacheUserName(sp, aCircuit); | 3439 | CacheUserName(sp, aCircuit); |
2882 | 3440 | ||
2883 | if (reallyNew) | 3441 | if (reallyNew) |
2884 | EventManager.TriggerOnNewClient(client); | 3442 | EventManager.TriggerOnNewClient(client); |
2885 | 3443 | ||
2886 | if (vialogin) | 3444 | if (vialogin) |
2887 | EventManager.TriggerOnClientLogin(client); | 3445 | EventManager.TriggerOnClientLogin(client); |
2888 | } | 3446 | } |
2889 | 3447 | ||
3448 | // User has logged into the scene so update the list of users logging | ||
3449 | // in | ||
3450 | StatsReporter.UpdateUsersLoggingIn(false); | ||
3451 | |||
2890 | m_LastLogin = Util.EnvironmentTickCount(); | 3452 | m_LastLogin = Util.EnvironmentTickCount(); |
2891 | 3453 | ||
2892 | return sp; | 3454 | return sp; |
@@ -2902,6 +3464,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2902 | } | 3464 | } |
2903 | 3465 | ||
2904 | /// <summary> | 3466 | /// <summary> |
3467 | /// Returns the Home URI of the agent, or null if unknown. | ||
3468 | /// </summary> | ||
3469 | public string GetAgentHomeURI(UUID agentID) | ||
3470 | { | ||
3471 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); | ||
3472 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) | ||
3473 | return circuit.ServiceURLs["HomeURI"].ToString(); | ||
3474 | else | ||
3475 | return null; | ||
3476 | } | ||
3477 | |||
3478 | /// <summary> | ||
2905 | /// Cache the user name for later use. | 3479 | /// Cache the user name for later use. |
2906 | /// </summary> | 3480 | /// </summary> |
2907 | /// <param name="sp"></param> | 3481 | /// <param name="sp"></param> |
@@ -2941,7 +3515,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2941 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | 3515 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) |
2942 | { | 3516 | { |
2943 | vialogin = false; | 3517 | vialogin = false; |
2944 | 3518 | ||
2945 | // Do the verification here | 3519 | // Do the verification here |
2946 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | 3520 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) |
2947 | { | 3521 | { |
@@ -3032,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3032 | { | 3606 | { |
3033 | // client.OnRegionHandShakeReply += SendLayerData; | 3607 | // client.OnRegionHandShakeReply += SendLayerData; |
3034 | } | 3608 | } |
3035 | 3609 | ||
3036 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 3610 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
3037 | { | 3611 | { |
3038 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3612 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
@@ -3044,7 +3618,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3044 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3618 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3045 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3619 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
3046 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 3620 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
3047 | 3621 | ||
3048 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 3622 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
3049 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 3623 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
3050 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 3624 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -3057,7 +3631,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3057 | client.OnSpinStart += m_sceneGraph.SpinStart; | 3631 | client.OnSpinStart += m_sceneGraph.SpinStart; |
3058 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 3632 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
3059 | client.OnDeRezObject += DeRezObjects; | 3633 | client.OnDeRezObject += DeRezObjects; |
3060 | 3634 | ||
3061 | client.OnObjectName += m_sceneGraph.PrimName; | 3635 | client.OnObjectName += m_sceneGraph.PrimName; |
3062 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 3636 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
3063 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 3637 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
@@ -3069,7 +3643,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3069 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 3643 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
3070 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 3644 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
3071 | client.OnGrabObject += ProcessObjectGrab; | 3645 | client.OnGrabObject += ProcessObjectGrab; |
3072 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | 3646 | client.OnGrabUpdate += ProcessObjectGrabUpdate; |
3073 | client.OnDeGrabObject += ProcessObjectDeGrab; | 3647 | client.OnDeGrabObject += ProcessObjectDeGrab; |
3074 | client.OnUndo += m_sceneGraph.HandleUndo; | 3648 | client.OnUndo += m_sceneGraph.HandleUndo; |
3075 | client.OnRedo += m_sceneGraph.HandleRedo; | 3649 | client.OnRedo += m_sceneGraph.HandleRedo; |
@@ -3131,7 +3705,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3131 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 3705 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
3132 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 3706 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
3133 | } | 3707 | } |
3134 | 3708 | ||
3135 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) | 3709 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) |
3136 | { | 3710 | { |
3137 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; | 3711 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
@@ -3325,8 +3899,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3325 | if (target != null && target2 != null) | 3899 | if (target != null && target2 != null) |
3326 | { | 3900 | { |
3327 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); | 3901 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); |
3328 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 3902 | Vector3 AXOrigin = RayStart; |
3329 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 3903 | Vector3 AXdirection = direction; |
3330 | 3904 | ||
3331 | pos = target2.AbsolutePosition; | 3905 | pos = target2.AbsolutePosition; |
3332 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); | 3906 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); |
@@ -3347,13 +3921,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3347 | if (ei.HitTF) | 3921 | if (ei.HitTF) |
3348 | { | 3922 | { |
3349 | Vector3 scale = target.Scale; | 3923 | Vector3 scale = target.Scale; |
3350 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 3924 | Vector3 scaleComponent = ei.AAfaceNormal; |
3351 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 3925 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
3352 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 3926 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
3353 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 3927 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
3354 | ScaleOffset = Math.Abs(ScaleOffset); | 3928 | ScaleOffset = Math.Abs(ScaleOffset); |
3355 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 3929 | Vector3 intersectionpoint = ei.ipoint; |
3356 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 3930 | Vector3 normal = ei.normal; |
3357 | Vector3 offset = normal * (ScaleOffset / 2f); | 3931 | Vector3 offset = normal * (ScaleOffset / 2f); |
3358 | pos = intersectionpoint + offset; | 3932 | pos = intersectionpoint + offset; |
3359 | 3933 | ||
@@ -3373,6 +3947,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3373 | { | 3947 | { |
3374 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); | 3948 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); |
3375 | } | 3949 | } |
3950 | |||
3376 | if (copy != null) | 3951 | if (copy != null) |
3377 | EventManager.TriggerObjectAddedToScene(copy); | 3952 | EventManager.TriggerObjectAddedToScene(copy); |
3378 | } | 3953 | } |
@@ -3380,7 +3955,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3380 | } | 3955 | } |
3381 | 3956 | ||
3382 | /// <summary> | 3957 | /// <summary> |
3383 | /// Get the avatar apperance for the given client. | 3958 | /// Get the avatar appearance for the given client. |
3384 | /// </summary> | 3959 | /// </summary> |
3385 | /// <param name="client"></param> | 3960 | /// <param name="client"></param> |
3386 | /// <param name="appearance"></param> | 3961 | /// <param name="appearance"></param> |
@@ -3433,18 +4008,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3433 | 4008 | ||
3434 | return; | 4009 | return; |
3435 | } | 4010 | } |
3436 | else | ||
3437 | { | ||
3438 | m_authenticateHandler.RemoveCircuit(agentID); | ||
3439 | } | ||
3440 | 4011 | ||
3441 | // TODO: Can we now remove this lock? | 4012 | // TODO: Can we now remove this lock? |
4013 | <<<<<<< HEAD | ||
4014 | lock (acd) | ||
4015 | { | ||
4016 | ======= | ||
3442 | lock (m_removeClientPrivLock) | 4017 | lock (m_removeClientPrivLock) |
3443 | { | 4018 | { |
4019 | >>>>>>> avn/ubitvar | ||
3444 | bool isChildAgent = false; | 4020 | bool isChildAgent = false; |
3445 | 4021 | ||
3446 | ScenePresence avatar = GetScenePresence(agentID); | 4022 | ScenePresence avatar = GetScenePresence(agentID); |
3447 | 4023 | ||
3448 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which | 4024 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which |
3449 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not | 4025 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not |
3450 | // However, will keep for now just in case. | 4026 | // However, will keep for now just in case. |
@@ -3452,7 +4028,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3452 | { | 4028 | { |
3453 | m_log.ErrorFormat( | 4029 | m_log.ErrorFormat( |
3454 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | 4030 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); |
3455 | 4031 | m_authenticateHandler.RemoveCircuit(agentID); | |
4032 | |||
3456 | return; | 4033 | return; |
3457 | } | 4034 | } |
3458 | 4035 | ||
@@ -3463,7 +4040,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3463 | m_log.DebugFormat( | 4040 | m_log.DebugFormat( |
3464 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | 4041 | "[SCENE]: Removing {0} agent {1} {2} from {3}", |
3465 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); | 4042 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); |
3466 | 4043 | ||
3467 | // Don't do this to root agents, it's not nice for the viewer | 4044 | // Don't do this to root agents, it's not nice for the viewer |
3468 | if (closeChildAgents && isChildAgent) | 4045 | if (closeChildAgents && isChildAgent) |
3469 | { | 4046 | { |
@@ -3471,20 +4048,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3471 | // Let's do this via UDP | 4048 | // Let's do this via UDP |
3472 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 4049 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3473 | } | 4050 | } |
3474 | 4051 | ||
3475 | // Only applies to root agents. | 4052 | // Only applies to root agents. |
3476 | if (avatar.ParentID != 0) | 4053 | if (avatar.ParentID != 0) |
3477 | { | 4054 | { |
3478 | avatar.StandUp(); | 4055 | avatar.StandUp(); |
3479 | } | 4056 | } |
3480 | 4057 | ||
3481 | m_sceneGraph.removeUserCount(!isChildAgent); | 4058 | m_sceneGraph.removeUserCount(!isChildAgent); |
3482 | 4059 | ||
3483 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 4060 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3484 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 4061 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3485 | if (closeChildAgents && CapsModule != null) | 4062 | if (closeChildAgents && CapsModule != null) |
4063 | <<<<<<< HEAD | ||
4064 | CapsModule.RemoveCaps(agentID); | ||
4065 | |||
4066 | ======= | ||
3486 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); | 4067 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); |
3487 | 4068 | ||
4069 | >>>>>>> avn/ubitvar | ||
3488 | if (closeChildAgents && !isChildAgent) | 4070 | if (closeChildAgents && !isChildAgent) |
3489 | { | 4071 | { |
3490 | List<ulong> regions = avatar.KnownRegionHandles; | 4072 | List<ulong> regions = avatar.KnownRegionHandles; |
@@ -3493,12 +4075,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3493 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. | 4075 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. |
3494 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); | 4076 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); |
3495 | } | 4077 | } |
3496 | 4078 | ||
3497 | m_eventManager.TriggerClientClosed(agentID, this); | 4079 | m_eventManager.TriggerClientClosed(agentID, this); |
3498 | // m_log.Debug("[Scene]TriggerClientClosed done"); | 4080 | // m_log.Debug("[Scene]TriggerClientClosed done"); |
3499 | m_eventManager.TriggerOnRemovePresence(agentID); | 4081 | m_eventManager.TriggerOnRemovePresence(agentID); |
4082 | <<<<<<< HEAD | ||
4083 | |||
4084 | ======= | ||
3500 | // m_log.Debug("[Scene]TriggerOnRemovePresence done"); | 4085 | // m_log.Debug("[Scene]TriggerOnRemovePresence done"); |
3501 | 4086 | ||
4087 | >>>>>>> avn/ubitvar | ||
3502 | if (!isChildAgent) | 4088 | if (!isChildAgent) |
3503 | { | 4089 | { |
3504 | if (AttachmentsModule != null) | 4090 | if (AttachmentsModule != null) |
@@ -3516,7 +4102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3516 | catch (NullReferenceException) { } | 4102 | catch (NullReferenceException) { } |
3517 | }); | 4103 | }); |
3518 | } | 4104 | } |
3519 | 4105 | ||
3520 | // It's possible for child agents to have transactions if changes are being made cross-border. | 4106 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3521 | if (AgentTransactionsModule != null) | 4107 | if (AgentTransactionsModule != null) |
3522 | { | 4108 | { |
@@ -3537,9 +4123,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3537 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | 4123 | // Always clean these structures up so that any failure above doesn't cause them to remain in the |
3538 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | 4124 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering |
3539 | // the same cleanup exception continually. | 4125 | // the same cleanup exception continually. |
4126 | m_authenticateHandler.RemoveCircuit(agentID); | ||
3540 | m_sceneGraph.RemoveScenePresence(agentID); | 4127 | m_sceneGraph.RemoveScenePresence(agentID); |
3541 | m_clientManager.Remove(agentID); | 4128 | m_clientManager.Remove(agentID); |
3542 | 4129 | ||
3543 | avatar.Close(); | 4130 | avatar.Close(); |
3544 | } | 4131 | } |
3545 | catch (Exception e) | 4132 | catch (Exception e) |
@@ -3609,12 +4196,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3609 | /// </summary> | 4196 | /// </summary> |
3610 | /// <param name="agent">CircuitData of the agent who is connecting</param> | 4197 | /// <param name="agent">CircuitData of the agent who is connecting</param> |
3611 | /// <param name="teleportFlags"></param> | 4198 | /// <param name="teleportFlags"></param> |
4199 | /// <param name="source">Source region (may be null)</param> | ||
3612 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 4200 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3613 | /// <returns>True if the region accepts this agent. False if it does not. False will | 4201 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3614 | /// also return a reason.</returns> | 4202 | /// also return a reason.</returns> |
3615 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 4203 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, GridRegion source, out string reason) |
3616 | { | 4204 | { |
3617 | return NewUserConnection(agent, teleportFlags, out reason, true); | 4205 | return NewUserConnection(agent, teleportFlags, source, out reason, true); |
3618 | } | 4206 | } |
3619 | 4207 | ||
3620 | /// <summary> | 4208 | /// <summary> |
@@ -3634,15 +4222,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | /// the LLUDP stack). | 4222 | /// the LLUDP stack). |
3635 | /// </remarks> | 4223 | /// </remarks> |
3636 | /// <param name="acd">CircuitData of the agent who is connecting</param> | 4224 | /// <param name="acd">CircuitData of the agent who is connecting</param> |
4225 | /// <param name="source">Source region (may be null)</param> | ||
3637 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 4226 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3638 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC | 4227 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC |
3639 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> | 4228 | /// or other applications where a full grid/Hypergrid presence may not be required.</param> |
3640 | /// <returns>True if the region accepts this agent. False if it does not. False will | 4229 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3641 | /// also return a reason.</returns> | 4230 | /// also return a reason.</returns> |
4231 | <<<<<<< HEAD | ||
4232 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) | ||
4233 | ======= | ||
3642 | /// | 4234 | /// |
3643 | private object m_newUserConnLock = new object(); | 4235 | private object m_newUserConnLock = new object(); |
3644 | 4236 | ||
3645 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) | 4237 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) |
4238 | >>>>>>> avn/ubitvar | ||
3646 | { | 4239 | { |
3647 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 4240 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3648 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 4241 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
@@ -3659,8 +4252,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3659 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport | 4252 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport |
3660 | 4253 | ||
3661 | // Don't disable this log message - it's too helpful | 4254 | // Don't disable this log message - it's too helpful |
4255 | string curViewer = Util.GetViewerName(acd); | ||
3662 | m_log.DebugFormat( | 4256 | m_log.DebugFormat( |
3663 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 4257 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", |
3664 | RegionInfo.RegionName, | 4258 | RegionInfo.RegionName, |
3665 | (acd.child ? "child" : "root"), | 4259 | (acd.child ? "child" : "root"), |
3666 | acd.firstname, | 4260 | acd.firstname, |
@@ -3668,9 +4262,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3668 | acd.AgentID, | 4262 | acd.AgentID, |
3669 | acd.circuitcode, | 4263 | acd.circuitcode, |
3670 | acd.IPAddress, | 4264 | acd.IPAddress, |
3671 | acd.Viewer, | 4265 | curViewer, |
3672 | ((TPFlags)teleportFlags).ToString(), | 4266 | ((TPFlags)teleportFlags).ToString(), |
3673 | acd.startpos | 4267 | acd.startpos, |
4268 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) | ||
3674 | ); | 4269 | ); |
3675 | 4270 | ||
3676 | // m_log.DebugFormat("NewUserConnection stack {0}", Environment.StackTrace); | 4271 | // m_log.DebugFormat("NewUserConnection stack {0}", Environment.StackTrace); |
@@ -3690,7 +4285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3690 | { | 4285 | { |
3691 | foreach (string viewer in m_AllowedViewers) | 4286 | foreach (string viewer in m_AllowedViewers) |
3692 | { | 4287 | { |
3693 | if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) | 4288 | if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower()) |
3694 | { | 4289 | { |
3695 | ViewerDenied = false; | 4290 | ViewerDenied = false; |
3696 | break; | 4291 | break; |
@@ -3707,7 +4302,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3707 | { | 4302 | { |
3708 | foreach (string viewer in m_BannedViewers) | 4303 | foreach (string viewer in m_BannedViewers) |
3709 | { | 4304 | { |
3710 | if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) | 4305 | if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower()) |
3711 | { | 4306 | { |
3712 | ViewerDenied = true; | 4307 | ViewerDenied = true; |
3713 | break; | 4308 | break; |
@@ -3719,7 +4314,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3719 | { | 4314 | { |
3720 | m_log.DebugFormat( | 4315 | m_log.DebugFormat( |
3721 | "[SCENE]: Access denied for {0} {1} using {2}", | 4316 | "[SCENE]: Access denied for {0} {1} using {2}", |
3722 | acd.firstname, acd.lastname, acd.Viewer); | 4317 | acd.firstname, acd.lastname, curViewer); |
3723 | reason = "Access denied, your viewer is banned by the region owner"; | 4318 | reason = "Access denied, your viewer is banned by the region owner"; |
3724 | return false; | 4319 | return false; |
3725 | } | 4320 | } |
@@ -3733,12 +4328,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3733 | 4328 | ||
3734 | // We need to ensure that we are not already removing the scene presence before we ask it not to be | 4329 | // We need to ensure that we are not already removing the scene presence before we ask it not to be |
3735 | // closed. | 4330 | // closed. |
3736 | if (sp != null && sp.IsChildAgent | 4331 | if (sp != null && sp.IsChildAgent |
3737 | && (sp.LifecycleState == ScenePresenceState.Running | 4332 | && (sp.LifecycleState == ScenePresenceState.Running |
3738 | || sp.LifecycleState == ScenePresenceState.PreRemove)) | 4333 | || sp.LifecycleState == ScenePresenceState.PreRemove)) |
3739 | { | 4334 | { |
3740 | m_log.DebugFormat( | 4335 | m_log.DebugFormat( |
3741 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", | 4336 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", |
3742 | sp.Name, sp.LifecycleState, Name); | 4337 | sp.Name, sp.LifecycleState, Name); |
3743 | 4338 | ||
3744 | // In the case where, for example, an A B C D region layout, an avatar may | 4339 | // In the case where, for example, an A B C D region layout, an avatar may |
@@ -3838,7 +4433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3838 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | 4433 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); |
3839 | 4434 | ||
3840 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | 4435 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); |
3841 | 4436 | ||
3842 | // On login test land permisions | 4437 | // On login test land permisions |
3843 | if (vialogin) | 4438 | if (vialogin) |
3844 | { | 4439 | { |
@@ -3895,7 +4490,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3895 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 4490 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3896 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, | 4491 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, |
3897 | acd.AgentID, acd.circuitcode); | 4492 | acd.AgentID, acd.circuitcode); |
3898 | 4493 | ||
3899 | if (CapsModule != null) | 4494 | if (CapsModule != null) |
3900 | { | 4495 | { |
3901 | CapsModule.SetAgentCapsSeeds(acd); | 4496 | CapsModule.SetAgentCapsSeeds(acd); |
@@ -3907,12 +4502,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3907 | // Let the SP know how we got here. This has a lot of interesting | 4502 | // Let the SP know how we got here. This has a lot of interesting |
3908 | // uses down the line. | 4503 | // uses down the line. |
3909 | sp.TeleportFlags = (TPFlags)teleportFlags; | 4504 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3910 | 4505 | ||
3911 | if (sp.IsChildAgent) | 4506 | if (sp.IsChildAgent) |
3912 | { | 4507 | { |
3913 | m_log.DebugFormat( | 4508 | m_log.DebugFormat( |
3914 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 4509 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
4510 | <<<<<<< HEAD | ||
4511 | acd.AgentID, RegionInfo.RegionName); | ||
4512 | |||
4513 | sp.AdjustKnownSeeds(); | ||
4514 | ======= | ||
3915 | acd.AgentID, RegionInfo.RegionName); | 4515 | acd.AgentID, RegionInfo.RegionName); |
4516 | >>>>>>> avn/ubitvar | ||
3916 | 4517 | ||
3917 | if (CapsModule != null) | 4518 | if (CapsModule != null) |
3918 | { | 4519 | { |
@@ -3982,17 +4583,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3982 | else | 4583 | else |
3983 | { | 4584 | { |
3984 | m_log.DebugFormat( | 4585 | m_log.DebugFormat( |
3985 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", | 4586 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", |
3986 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4587 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3987 | } | 4588 | } |
3988 | } | 4589 | } |
3989 | else | 4590 | else |
3990 | { | 4591 | { |
3991 | m_log.DebugFormat( | 4592 | m_log.DebugFormat( |
3992 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", | 4593 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", |
3993 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4594 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3994 | } | 4595 | } |
3995 | 4596 | ||
4597 | // Final permissions check; this time we don't allow changing the position | ||
4598 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
4599 | { | ||
4600 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
4601 | return false; | ||
4602 | } | ||
4603 | |||
3996 | return true; | 4604 | return true; |
3997 | } | 4605 | } |
3998 | 4606 | ||
@@ -4004,6 +4612,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4004 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4612 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
4005 | { | 4613 | { |
4006 | acd.startpos = land.LandData.UserLocation; | 4614 | acd.startpos = land.LandData.UserLocation; |
4615 | |||
4616 | // Final permissions check; this time we don't allow changing the position | ||
4617 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
4618 | { | ||
4619 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
4620 | return false; | ||
4621 | } | ||
4007 | } | 4622 | } |
4008 | } | 4623 | } |
4009 | */// This is now handled properly in ScenePresence.MakeRootAgent | 4624 | */// This is now handled properly in ScenePresence.MakeRootAgent |
@@ -4012,16 +4627,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
4012 | return true; | 4627 | return true; |
4013 | } | 4628 | } |
4014 | 4629 | ||
4630 | private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason) | ||
4631 | { | ||
4632 | ILandObject land = LandChannel.GetLandObject(pos); | ||
4633 | if (land == null) | ||
4634 | return true; | ||
4635 | |||
4636 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) | ||
4637 | { | ||
4638 | reason = "You are banned from the region."; | ||
4639 | return false; | ||
4640 | } | ||
4641 | |||
4642 | return true; | ||
4643 | } | ||
4644 | |||
4015 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) | 4645 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
4016 | { | 4646 | { |
4017 | if (posX < 0) | 4647 | if (posX < 0) |
4018 | posX = 0; | 4648 | posX = 0; |
4649 | <<<<<<< HEAD | ||
4650 | else if (posX >= (float)RegionInfo.RegionSizeX) | ||
4651 | posX = (float)RegionInfo.RegionSizeX - 0.001f; | ||
4652 | if (posY < 0) | ||
4653 | posY = 0; | ||
4654 | else if (posY >= (float)RegionInfo.RegionSizeY) | ||
4655 | posY = (float)RegionInfo.RegionSizeY - 0.001f; | ||
4656 | ======= | ||
4019 | else if (posX >= RegionInfo.RegionSizeX) | 4657 | else if (posX >= RegionInfo.RegionSizeX) |
4020 | posX = RegionInfo.RegionSizeX - 0.5f; | 4658 | posX = RegionInfo.RegionSizeX - 0.5f; |
4021 | if (posY < 0) | 4659 | if (posY < 0) |
4022 | posY = 0; | 4660 | posY = 0; |
4023 | else if (posY >= RegionInfo.RegionSizeY) | 4661 | else if (posY >= RegionInfo.RegionSizeY) |
4024 | posY = RegionInfo.RegionSizeY - 0.5f; | 4662 | posY = RegionInfo.RegionSizeY - 0.5f; |
4663 | >>>>>>> avn/ubitvar | ||
4025 | 4664 | ||
4026 | reason = String.Empty; | 4665 | reason = String.Empty; |
4027 | if (Permissions.IsGod(agentID)) | 4666 | if (Permissions.IsGod(agentID)) |
@@ -4053,7 +4692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4053 | else | 4692 | else |
4054 | { | 4693 | { |
4055 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4694 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4056 | RegionInfo.RegionName); | 4695 | RegionInfo.RegionName); |
4057 | } | 4696 | } |
4058 | return false; | 4697 | return false; |
4059 | } | 4698 | } |
@@ -4110,9 +4749,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4110 | if (!AuthorizationService.IsAuthorizedForRegion( | 4749 | if (!AuthorizationService.IsAuthorizedForRegion( |
4111 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | 4750 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) |
4112 | { | 4751 | { |
4113 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", | 4752 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", |
4114 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); | 4753 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); |
4115 | 4754 | ||
4116 | return false; | 4755 | return false; |
4117 | } | 4756 | } |
4118 | } | 4757 | } |
@@ -4332,7 +4971,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4332 | } | 4971 | } |
4333 | 4972 | ||
4334 | // TODO: This check should probably be in QueryAccess(). | 4973 | // TODO: This check should probably be in QueryAccess(). |
4335 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4974 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4336 | if (nearestParcel == null) | 4975 | if (nearestParcel == null) |
4337 | { | 4976 | { |
4338 | m_log.InfoFormat( | 4977 | m_log.InfoFormat( |
@@ -4401,7 +5040,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4401 | /// <returns>true if we handled it.</returns> | 5040 | /// <returns>true if we handled it.</returns> |
4402 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 5041 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4403 | { | 5042 | { |
4404 | //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); | 5043 | // m_log.DebugFormat( |
5044 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | ||
5045 | // cAgentData.AgentID, Name, cAgentData.Position); | ||
5046 | |||
4405 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 5047 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4406 | if (childAgentUpdate != null) | 5048 | if (childAgentUpdate != null) |
4407 | { | 5049 | { |
@@ -4556,7 +5198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4556 | lock (m_removeClientLock) | 5198 | lock (m_removeClientLock) |
4557 | { | 5199 | { |
4558 | sp = GetScenePresence(agentID); | 5200 | sp = GetScenePresence(agentID); |
4559 | 5201 | ||
4560 | if (sp == null) | 5202 | if (sp == null) |
4561 | { | 5203 | { |
4562 | // If there is no scene presence, we may be handling a dead | 5204 | // If there is no scene presence, we may be handling a dead |
@@ -4576,7 +5218,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4576 | m_log.DebugFormat( | 5218 | m_log.DebugFormat( |
4577 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", | 5219 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", |
4578 | agentID, Name); | 5220 | agentID, Name); |
4579 | 5221 | ||
4580 | return false; | 5222 | return false; |
4581 | } | 5223 | } |
4582 | 5224 | ||
@@ -4607,14 +5249,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4607 | sp.LifecycleState = ScenePresenceState.Removing; | 5249 | sp.LifecycleState = ScenePresenceState.Removing; |
4608 | } | 5250 | } |
4609 | 5251 | ||
5252 | <<<<<<< HEAD | ||
5253 | sp.ControllingClient.Close(force); | ||
5254 | ======= | ||
4610 | if (sp != null) | 5255 | if (sp != null) |
4611 | { | 5256 | { |
4612 | sp.ControllingClient.Close(force, force); | 5257 | sp.ControllingClient.Close(force, force); |
4613 | return true; | 5258 | return true; |
4614 | } | 5259 | } |
5260 | >>>>>>> avn/ubitvar | ||
4615 | 5261 | ||
4616 | // Agent not here | 5262 | return true; |
4617 | return false; | ||
4618 | } | 5263 | } |
4619 | 5264 | ||
4620 | /// <summary> | 5265 | /// <summary> |
@@ -4803,7 +5448,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4803 | 5448 | ||
4804 | #region Script Engine | 5449 | #region Script Engine |
4805 | 5450 | ||
4806 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 5451 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
4807 | { | 5452 | { |
4808 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 5453 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
4809 | if (part != null) | 5454 | if (part != null) |
@@ -4814,35 +5459,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
4814 | { | 5459 | { |
4815 | return true; | 5460 | return true; |
4816 | } | 5461 | } |
4817 | else if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 5462 | else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID)) |
4818 | { | 5463 | { |
4819 | if (part.OwnerID == parcel.LandData.OwnerID | 5464 | return true; |
4820 | || (parcel.LandData.IsGroupOwned && part.GroupID == parcel.LandData.GroupID) | 5465 | } |
4821 | || Permissions.IsGod(part.OwnerID)) | 5466 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
4822 | { | 5467 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) |
4823 | return true; | 5468 | { |
4824 | } | 5469 | return true; |
4825 | else | ||
4826 | { | ||
4827 | return false; | ||
4828 | } | ||
4829 | } | 5470 | } |
4830 | else | 5471 | else |
4831 | { | 5472 | { |
4832 | if (part.OwnerID == parcel.LandData.OwnerID) | 5473 | return false; |
4833 | { | ||
4834 | return true; | ||
4835 | } | ||
4836 | else | ||
4837 | { | ||
4838 | return false; | ||
4839 | } | ||
4840 | } | 5474 | } |
4841 | } | 5475 | } |
4842 | else | 5476 | else |
4843 | { | 5477 | { |
4844 | 5478 | ||
4845 | if (pos.X > 0f && pos.X < Constants.RegionSize && pos.Y > 0f && pos.Y < Constants.RegionSize) | 5479 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) |
4846 | { | 5480 | { |
4847 | // The only time parcel != null when an object is inside a region is when | 5481 | // The only time parcel != null when an object is inside a region is when |
4848 | // there is nothing behind the landchannel. IE, no land plugin loaded. | 5482 | // there is nothing behind the landchannel. IE, no land plugin loaded. |
@@ -5228,6 +5862,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5228 | // 5 = We have seen a new user enter within the past 4 minutes | 5862 | // 5 = We have seen a new user enter within the past 4 minutes |
5229 | // which can be seen as positive confirmation of sim health | 5863 | // which can be seen as positive confirmation of sim health |
5230 | // | 5864 | // |
5865 | <<<<<<< HEAD | ||
5866 | int health = 1; // Start at 1, means we're up | ||
5867 | ======= | ||
5231 | 5868 | ||
5232 | flags = 0; | 5869 | flags = 0; |
5233 | message = String.Empty; | 5870 | message = String.Empty; |
@@ -5243,6 +5880,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5243 | } | 5880 | } |
5244 | 5881 | ||
5245 | int health=1; // Start at 1, means we're up | 5882 | int health=1; // Start at 1, means we're up |
5883 | >>>>>>> avn/ubitvar | ||
5246 | 5884 | ||
5247 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5885 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5248 | { | 5886 | { |
@@ -5315,7 +5953,7 @@ Environment.Exit(1); | |||
5315 | case PhysicsJointType.Ball: | 5953 | case PhysicsJointType.Ball: |
5316 | { | 5954 | { |
5317 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5955 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5318 | Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); | 5956 | Vector3 proxyPos = jointAnchor; |
5319 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5957 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5320 | } | 5958 | } |
5321 | break; | 5959 | break; |
@@ -5340,7 +5978,7 @@ Environment.Exit(1); | |||
5340 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); | 5978 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); |
5341 | } | 5979 | } |
5342 | 5980 | ||
5343 | Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); | 5981 | Vector3 proxyPos = jointAnchor; |
5344 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; | 5982 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; |
5345 | 5983 | ||
5346 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5984 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
@@ -5429,6 +6067,10 @@ Environment.Exit(1); | |||
5429 | return null; | 6067 | return null; |
5430 | } | 6068 | } |
5431 | 6069 | ||
6070 | // Get terrain height at the specified <x,y> location. | ||
6071 | // Presumes the underlying implementation is a heightmap which is a 1m grid. | ||
6072 | // Finds heightmap grid points before and after the point and | ||
6073 | // does a linear approximation of the height at this intermediate point. | ||
5432 | public float GetGroundHeight(float x, float y) | 6074 | public float GetGroundHeight(float x, float y) |
5433 | { | 6075 | { |
5434 | if (x < 0) | 6076 | if (x < 0) |
@@ -5441,8 +6083,8 @@ Environment.Exit(1); | |||
5441 | y = Heightmap.Height - 1; | 6083 | y = Heightmap.Height - 1; |
5442 | 6084 | ||
5443 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); | 6085 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); |
5444 | Vector3 p1 = new Vector3(p0); | 6086 | Vector3 p1 = p0; |
5445 | Vector3 p2 = new Vector3(p0); | 6087 | Vector3 p2 = p0; |
5446 | 6088 | ||
5447 | p1.X += 1.0f; | 6089 | p1.X += 1.0f; |
5448 | if (p1.X < Heightmap.Width) | 6090 | if (p1.X < Heightmap.Width) |
@@ -5505,7 +6147,7 @@ Environment.Exit(1); | |||
5505 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 6147 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5506 | if (nearestPoint != null) | 6148 | if (nearestPoint != null) |
5507 | { | 6149 | { |
5508 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); | 6150 | m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5509 | return nearestPoint.Value; | 6151 | return nearestPoint.Value; |
5510 | } | 6152 | } |
5511 | 6153 | ||
@@ -5515,16 +6157,16 @@ Environment.Exit(1); | |||
5515 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 6157 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5516 | if (nearestPoint != null) | 6158 | if (nearestPoint != null) |
5517 | { | 6159 | { |
5518 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); | 6160 | m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5519 | return nearestPoint.Value; | 6161 | return nearestPoint.Value; |
5520 | } | 6162 | } |
5521 | 6163 | ||
5522 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); | 6164 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5523 | if (dest != excludeParcel) | 6165 | if (dest != excludeParcel) |
5524 | { | 6166 | { |
5525 | // Ultimate backup if we have no idea where they are and | 6167 | // Ultimate backup if we have no idea where they are and |
5526 | // the last allowed position was in another parcel | 6168 | // the last allowed position was in another parcel |
5527 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | 6169 | m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); |
5528 | return avatar.lastKnownAllowedPosition; | 6170 | return avatar.lastKnownAllowedPosition; |
5529 | } | 6171 | } |
5530 | 6172 | ||
@@ -5534,8 +6176,13 @@ Environment.Exit(1); | |||
5534 | //Go to the edge, this happens in teleporting to a region with no available parcels | 6176 | //Go to the edge, this happens in teleporting to a region with no available parcels |
5535 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); | 6177 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); |
5536 | 6178 | ||
6179 | <<<<<<< HEAD | ||
6180 | //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | ||
6181 | |||
6182 | ======= | ||
5537 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | 6183 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); |
5538 | 6184 | ||
6185 | >>>>>>> avn/ubitvar | ||
5539 | return nearestRegionEdgePoint; | 6186 | return nearestRegionEdgePoint; |
5540 | } | 6187 | } |
5541 | 6188 | ||
@@ -5549,7 +6196,7 @@ Environment.Exit(1); | |||
5549 | { | 6196 | { |
5550 | Vector3 unitDirection = Vector3.Normalize(direction); | 6197 | Vector3 unitDirection = Vector3.Normalize(direction); |
5551 | //Making distance to search go through some sane limit of distance | 6198 | //Making distance to search go through some sane limit of distance |
5552 | for (float distance = 0; distance < Constants.RegionSize * 2; distance += .5f) | 6199 | for (float distance = 0; distance < Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY) * 2; distance += .5f) |
5553 | { | 6200 | { |
5554 | Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); | 6201 | Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); |
5555 | if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) | 6202 | if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) |
@@ -5603,9 +6250,9 @@ Environment.Exit(1); | |||
5603 | int count = 0; | 6250 | int count = 0; |
5604 | int avgx = 0; | 6251 | int avgx = 0; |
5605 | int avgy = 0; | 6252 | int avgy = 0; |
5606 | for (int x = 0; x < Constants.RegionSize; x++) | 6253 | for (int x = 0; x < RegionInfo.RegionSizeX; x++) |
5607 | { | 6254 | { |
5608 | for (int y = 0; y < Constants.RegionSize; y++) | 6255 | for (int y = 0; y < RegionInfo.RegionSizeY; y++) |
5609 | { | 6256 | { |
5610 | //Just keep a running average as we check if all the points are inside or not | 6257 | //Just keep a running average as we check if all the points are inside or not |
5611 | if (parcel.ContainsPoint(x, y)) | 6258 | if (parcel.ContainsPoint(x, y)) |
@@ -5629,31 +6276,33 @@ Environment.Exit(1); | |||
5629 | 6276 | ||
5630 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | 6277 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) |
5631 | { | 6278 | { |
5632 | float xdistance = avatar.AbsolutePosition.X < Constants.RegionSize / 2 ? avatar.AbsolutePosition.X : Constants.RegionSize - avatar.AbsolutePosition.X; | 6279 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 |
5633 | float ydistance = avatar.AbsolutePosition.Y < Constants.RegionSize / 2 ? avatar.AbsolutePosition.Y : Constants.RegionSize - avatar.AbsolutePosition.Y; | 6280 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; |
6281 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 | ||
6282 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; | ||
5634 | 6283 | ||
5635 | //find out what vertical edge to go to | 6284 | //find out what vertical edge to go to |
5636 | if (xdistance < ydistance) | 6285 | if (xdistance < ydistance) |
5637 | { | 6286 | { |
5638 | if (avatar.AbsolutePosition.X < Constants.RegionSize / 2) | 6287 | if (avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2) |
5639 | { | 6288 | { |
5640 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); | 6289 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); |
5641 | } | 6290 | } |
5642 | else | 6291 | else |
5643 | { | 6292 | { |
5644 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, Constants.RegionSize, avatar.AbsolutePosition.Y); | 6293 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, RegionInfo.RegionSizeY, avatar.AbsolutePosition.Y); |
5645 | } | 6294 | } |
5646 | } | 6295 | } |
5647 | //find out what horizontal edge to go to | 6296 | //find out what horizontal edge to go to |
5648 | else | 6297 | else |
5649 | { | 6298 | { |
5650 | if (avatar.AbsolutePosition.Y < Constants.RegionSize / 2) | 6299 | if (avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2) |
5651 | { | 6300 | { |
5652 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); | 6301 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); |
5653 | } | 6302 | } |
5654 | else | 6303 | else |
5655 | { | 6304 | { |
5656 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, Constants.RegionSize); | 6305 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, RegionInfo.RegionSizeY); |
5657 | } | 6306 | } |
5658 | } | 6307 | } |
5659 | } | 6308 | } |
@@ -5719,7 +6368,7 @@ Environment.Exit(1); | |||
5719 | /// <param name="maxZ"></param> | 6368 | /// <param name="maxZ"></param> |
5720 | /// <returns></returns> | 6369 | /// <returns></returns> |
5721 | public static Vector3[] GetCombinedBoundingBox( | 6370 | public static Vector3[] GetCombinedBoundingBox( |
5722 | List<SceneObjectGroup> objects, | 6371 | List<SceneObjectGroup> objects, |
5723 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 6372 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
5724 | { | 6373 | { |
5725 | minX = float.MaxValue; | 6374 | minX = float.MaxValue; |
@@ -5738,7 +6387,7 @@ Environment.Exit(1); | |||
5738 | Vector3 vec = g.AbsolutePosition; | 6387 | Vector3 vec = g.AbsolutePosition; |
5739 | 6388 | ||
5740 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 6389 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
5741 | 6390 | ||
5742 | // m_log.DebugFormat( | 6391 | // m_log.DebugFormat( |
5743 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", | 6392 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", |
5744 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); | 6393 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); |
@@ -5845,7 +6494,7 @@ Environment.Exit(1); | |||
5845 | // so that all simulators can retrieve it | 6494 | // so that all simulators can retrieve it |
5846 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | 6495 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); |
5847 | if (error != string.Empty) | 6496 | if (error != string.Empty) |
5848 | throw new Exception(error); | 6497 | throw new Exception(error); |
5849 | } | 6498 | } |
5850 | 6499 | ||
5851 | /// <summary> | 6500 | /// <summary> |
@@ -5864,9 +6513,13 @@ Environment.Exit(1); | |||
5864 | /// <param name='position'></param> | 6513 | /// <param name='position'></param> |
5865 | /// <param name='reason'></param> | 6514 | /// <param name='reason'></param> |
5866 | /// <returns></returns> | 6515 | /// <returns></returns> |
6516 | <<<<<<< HEAD | ||
6517 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason) | ||
6518 | ======= | ||
5867 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) | 6519 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) |
6520 | >>>>>>> avn/ubitvar | ||
5868 | { | 6521 | { |
5869 | reason = "You are banned from the region"; | 6522 | reason = string.Empty; |
5870 | 6523 | ||
5871 | if (Permissions.IsGod(agentID)) | 6524 | if (Permissions.IsGod(agentID)) |
5872 | { | 6525 | { |
@@ -5874,9 +6527,14 @@ Environment.Exit(1); | |||
5874 | return true; | 6527 | return true; |
5875 | } | 6528 | } |
5876 | 6529 | ||
6530 | <<<<<<< HEAD | ||
6531 | if (!AllowAvatarCrossing && !viaTeleport) | ||
6532 | return false; | ||
6533 | ======= | ||
5877 | 6534 | ||
5878 | // if (!AllowAvatarCrossing && !viaTeleport) | 6535 | // if (!AllowAvatarCrossing && !viaTeleport) |
5879 | // return false; | 6536 | // return false; |
6537 | >>>>>>> avn/ubitvar | ||
5880 | 6538 | ||
5881 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 6539 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5882 | // However, the long term fix is to make sure root agent count is always accurate. | 6540 | // However, the long term fix is to make sure root agent count is always accurate. |
@@ -5929,11 +6587,12 @@ Environment.Exit(1); | |||
5929 | } | 6587 | } |
5930 | catch (Exception e) | 6588 | catch (Exception e) |
5931 | { | 6589 | { |
5932 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | 6590 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} " + e.StackTrace, e.Message); |
6591 | reason = "Error authorizing agent: " + e.Message; | ||
5933 | return false; | 6592 | return false; |
5934 | } | 6593 | } |
5935 | 6594 | ||
5936 | if (position == Vector3.Zero) // Teleport | 6595 | if (viaTeleport) |
5937 | { | 6596 | { |
5938 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 6597 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
5939 | { | 6598 | { |
@@ -5956,7 +6615,7 @@ Environment.Exit(1); | |||
5956 | 6615 | ||
5957 | if (banned) | 6616 | if (banned) |
5958 | { | 6617 | { |
5959 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) | 6618 | if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5960 | { | 6619 | { |
5961 | reason = "No suitable landing point found"; | 6620 | reason = "No suitable landing point found"; |
5962 | return false; | 6621 | return false; |
@@ -5973,6 +6632,7 @@ Environment.Exit(1); | |||
5973 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | 6632 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) |
5974 | { | 6633 | { |
5975 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | 6634 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); |
6635 | reason = "You are banned from the region on all parcels"; | ||
5976 | return false; | 6636 | return false; |
5977 | } | 6637 | } |
5978 | } | 6638 | } |
@@ -5980,13 +6640,22 @@ Environment.Exit(1); | |||
5980 | { | 6640 | { |
5981 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | 6641 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); |
5982 | if (land == null) | 6642 | if (land == null) |
6643 | { | ||
6644 | reason = "No parcel found"; | ||
5983 | return false; | 6645 | return false; |
6646 | } | ||
5984 | 6647 | ||
5985 | bool banned = land.IsBannedFromLand(agentID); | 6648 | bool banned = land.IsBannedFromLand(agentID); |
5986 | bool restricted = land.IsRestrictedFromLand(agentID); | 6649 | bool restricted = land.IsRestrictedFromLand(agentID); |
5987 | 6650 | ||
5988 | if (banned || restricted) | 6651 | if (banned || restricted) |
6652 | { | ||
6653 | if (banned) | ||
6654 | reason = "You are banned from the parcel"; | ||
6655 | else | ||
6656 | reason = "The parcel is restricted"; | ||
5989 | return false; | 6657 | return false; |
6658 | } | ||
5990 | } | 6659 | } |
5991 | 6660 | ||
5992 | reason = String.Empty; | 6661 | reason = String.Empty; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 9648030..c4671f0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -1,598 +1,1237 @@ | |||
1 | /* | 1 | <<<<<<< HEAD |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | /* |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * Copyright (c) Contributors, http://opensimulator.org/ |
4 | * | 4 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * * Redistributions of source code must retain the above copyright | 7 | * modification, are permitted provided that the following conditions are met: |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * * Redistributions of source code must retain the above copyright |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * * Redistributions in binary form must reproduce the above copyright |
11 | * documentation and/or other materials provided with the distribution. | 11 | * notice, this list of conditions and the following disclaimer in the |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * documentation and/or other materials provided with the distribution. |
13 | * names of its contributors may be used to endorse or promote products | 13 | * * Neither the name of the OpenSimulator Project nor the |
14 | * derived from this software without specific prior written permission. | 14 | * names of its contributors may be used to endorse or promote products |
15 | * | 15 | * derived from this software without specific prior written permission. |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
26 | */ | 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 | */ | |
28 | using System; | 28 | |
29 | using System.Collections.Generic; | 29 | using System; |
30 | using System.Reflection; | 30 | using System.Collections.Generic; |
31 | using System.Threading; | 31 | using System.Reflection; |
32 | using OpenMetaverse; | 32 | using System.Threading; |
33 | using log4net; | 33 | using OpenMetaverse; |
34 | using Nini.Config; | 34 | using log4net; |
35 | using OpenSim.Framework; | 35 | using Nini.Config; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework; |
37 | 37 | using OpenSim.Framework.Console; | |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |
41 | namespace OpenSim.Region.Framework.Scenes | 41 | |
42 | { | 42 | namespace OpenSim.Region.Framework.Scenes |
43 | public abstract class SceneBase : IScene | 43 | { |
44 | { | 44 | public abstract class SceneBase : IScene |
45 | protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | { |
46 | protected static readonly string LogHeader = "[SCENE]"; | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | #region Events | 48 | #pragma warning disable 414 |
49 | 49 | private static readonly string LogHeader = "[SCENE]"; | |
50 | public event restart OnRestart; | 50 | #pragma warning restore 414 |
51 | 51 | ||
52 | #endregion | 52 | #region Events |
53 | 53 | ||
54 | #region Fields | 54 | public event restart OnRestart; |
55 | 55 | ||
56 | public string Name { get { return RegionInfo.RegionName; } } | 56 | #endregion |
57 | 57 | ||
58 | public IConfigSource Config | 58 | #region Fields |
59 | { | 59 | |
60 | get { return GetConfig(); } | 60 | public string Name { get { return RegionInfo.RegionName; } } |
61 | } | 61 | |
62 | 62 | public IConfigSource Config | |
63 | protected virtual IConfigSource GetConfig() | 63 | { |
64 | { | 64 | get { return GetConfig(); } |
65 | return null; | 65 | } |
66 | } | 66 | |
67 | 67 | protected virtual IConfigSource GetConfig() | |
68 | /// <value> | 68 | { |
69 | /// All the region modules attached to this scene. | 69 | return null; |
70 | /// </value> | 70 | } |
71 | public Dictionary<string, IRegionModuleBase> RegionModules | 71 | |
72 | { | 72 | /// <value> |
73 | get { return m_regionModules; } | 73 | /// All the region modules attached to this scene. |
74 | } | 74 | /// </value> |
75 | private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>(); | 75 | public Dictionary<string, IRegionModuleBase> RegionModules |
76 | 76 | { | |
77 | /// <value> | 77 | get { return m_regionModules; } |
78 | /// The module interfaces available from this scene. | 78 | } |
79 | /// </value> | 79 | private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>(); |
80 | protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); | 80 | |
81 | 81 | /// <value> | |
82 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | 82 | /// The module interfaces available from this scene. |
83 | 83 | /// </value> | |
84 | /// <value> | 84 | protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); |
85 | /// The module commanders available from this scene | 85 | |
86 | /// </value> | 86 | /// <summary> |
87 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); | 87 | /// These two objects hold the information about any formats used |
88 | 88 | /// by modules that hold agent specific data. | |
89 | /// <value> | 89 | /// </summary> |
90 | /// Registered classes that are capable of creating entities. | 90 | protected List<UUID> FormatsOffered = new List<UUID>(); |
91 | /// </value> | 91 | protected Dictionary<object, List<UUID>> FormatsWanted = new Dictionary<object, List<UUID>>(); |
92 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | 92 | |
93 | 93 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | |
94 | /// <summary> | 94 | |
95 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is | 95 | /// <value> |
96 | /// dispensed. | 96 | /// The module commanders available from this scene |
97 | /// </summary> | 97 | /// </value> |
98 | protected uint m_lastAllocatedLocalId = 720000; | 98 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); |
99 | 99 | ||
100 | private readonly Mutex _primAllocateMutex = new Mutex(false); | 100 | /// <value> |
101 | 101 | /// Registered classes that are capable of creating entities. | |
102 | protected readonly ClientManager m_clientManager = new ClientManager(); | 102 | /// </value> |
103 | 103 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | |
104 | public bool LoginsEnabled | 104 | |
105 | { | 105 | /// <summary> |
106 | get | 106 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is |
107 | { | 107 | /// dispensed. |
108 | return m_loginsEnabled; | 108 | /// </summary> |
109 | } | 109 | protected uint m_lastAllocatedLocalId = 720000; |
110 | 110 | ||
111 | set | 111 | private readonly Mutex _primAllocateMutex = new Mutex(false); |
112 | { | 112 | |
113 | if (m_loginsEnabled != value) | 113 | protected readonly ClientManager m_clientManager = new ClientManager(); |
114 | { | 114 | |
115 | m_loginsEnabled = value; | 115 | public bool LoginsEnabled |
116 | EventManager.TriggerRegionLoginsStatusChange(this); | 116 | { |
117 | } | 117 | get |
118 | } | 118 | { |
119 | } | 119 | return m_loginsEnabled; |
120 | private bool m_loginsEnabled; | 120 | } |
121 | 121 | ||
122 | public bool Ready | 122 | set |
123 | { | 123 | { |
124 | get | 124 | if (m_loginsEnabled != value) |
125 | { | 125 | { |
126 | return m_ready; | 126 | m_loginsEnabled = value; |
127 | } | 127 | EventManager.TriggerRegionLoginsStatusChange(this); |
128 | 128 | } | |
129 | set | 129 | } |
130 | { | 130 | } |
131 | if (m_ready != value) | 131 | private bool m_loginsEnabled; |
132 | { | 132 | |
133 | m_ready = value; | 133 | public bool Ready |
134 | EventManager.TriggerRegionReadyStatusChange(this); | 134 | { |
135 | } | 135 | get |
136 | } | 136 | { |
137 | } | 137 | return m_ready; |
138 | private bool m_ready; | 138 | } |
139 | 139 | ||
140 | public float TimeDilation | 140 | set |
141 | { | 141 | { |
142 | get { return 1.0f; } | 142 | if (m_ready != value) |
143 | } | 143 | { |
144 | 144 | m_ready = value; | |
145 | protected ulong m_regionHandle; | 145 | EventManager.TriggerRegionReadyStatusChange(this); |
146 | protected string m_regionName; | 146 | } |
147 | 147 | } | |
148 | public ITerrainChannel Heightmap; | 148 | } |
149 | 149 | private bool m_ready; | |
150 | /// <value> | 150 | |
151 | /// Allows retrieval of land information for this scene. | 151 | public float TimeDilation |
152 | /// </value> | 152 | { |
153 | public ILandChannel LandChannel; | 153 | get { return 1.0f; } |
154 | 154 | } | |
155 | /// <value> | 155 | |
156 | /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules | 156 | public ITerrainChannel Heightmap; |
157 | /// to subscribe to scene events. | 157 | |
158 | /// </value> | 158 | /// <value> |
159 | public EventManager EventManager | 159 | /// Allows retrieval of land information for this scene. |
160 | { | 160 | /// </value> |
161 | get { return m_eventManager; } | 161 | public ILandChannel LandChannel; |
162 | } | 162 | |
163 | protected EventManager m_eventManager; | 163 | /// <value> |
164 | 164 | /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules | |
165 | protected ScenePermissions m_permissions; | 165 | /// to subscribe to scene events. |
166 | public ScenePermissions Permissions | 166 | /// </value> |
167 | { | 167 | public EventManager EventManager |
168 | get { return m_permissions; } | 168 | { |
169 | } | 169 | get { return m_eventManager; } |
170 | 170 | } | |
171 | protected string m_datastore; | 171 | protected EventManager m_eventManager; |
172 | 172 | ||
173 | /* Used by the loadbalancer plugin on GForge */ | 173 | protected ScenePermissions m_permissions; |
174 | protected RegionStatus m_regStatus; | 174 | public ScenePermissions Permissions |
175 | public RegionStatus RegionStatus | 175 | { |
176 | { | 176 | get { return m_permissions; } |
177 | get { return m_regStatus; } | 177 | } |
178 | set { m_regStatus = value; } | 178 | |
179 | } | 179 | /* Used by the loadbalancer plugin on GForge */ |
180 | 180 | protected RegionStatus m_regStatus; | |
181 | #endregion | 181 | public RegionStatus RegionStatus |
182 | 182 | { | |
183 | public SceneBase(RegionInfo regInfo) | 183 | get { return m_regStatus; } |
184 | { | 184 | set { m_regStatus = value; } |
185 | RegionInfo = regInfo; | 185 | } |
186 | } | 186 | |
187 | 187 | #endregion | |
188 | #region Update Methods | 188 | |
189 | 189 | public SceneBase(RegionInfo regInfo) | |
190 | /// <summary> | 190 | { |
191 | /// Called to update the scene loop by a number of frames and until shutdown. | 191 | RegionInfo = regInfo; |
192 | /// </summary> | 192 | } |
193 | /// <param name="frames"> | 193 | |
194 | /// Number of frames to update. Exits on shutdown even if there are frames remaining. | 194 | #region Update Methods |
195 | /// If -1 then updates until shutdown. | 195 | |
196 | /// </param> | 196 | /// <summary> |
197 | public abstract void Update(int frames); | 197 | /// Called to update the scene loop by a number of frames and until shutdown. |
198 | 198 | /// </summary> | |
199 | #endregion | 199 | /// <param name="frames"> |
200 | 200 | /// Number of frames to update. Exits on shutdown even if there are frames remaining. | |
201 | #region Terrain Methods | 201 | /// If -1 then updates until shutdown. |
202 | 202 | /// </param> | |
203 | /// <summary> | 203 | /// <returns>true if update completed within minimum frame time, false otherwise.</returns> |
204 | /// Loads the World heightmap | 204 | public abstract bool Update(int frames); |
205 | /// </summary> | 205 | |
206 | public abstract void LoadWorldMap(); | 206 | #endregion |
207 | 207 | ||
208 | /// <summary> | 208 | #region Terrain Methods |
209 | /// Send the region heightmap to the client | 209 | |
210 | /// </summary> | 210 | /// <summary> |
211 | /// <param name="RemoteClient">Client to send to</param> | 211 | /// Loads the World heightmap |
212 | public virtual void SendLayerData(IClientAPI RemoteClient) | 212 | /// </summary> |
213 | { | 213 | public abstract void LoadWorldMap(); |
214 | // RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); | 214 | |
215 | ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>(); | 215 | /// <summary> |
216 | if (terrModule != null) | 216 | /// Send the region heightmap to the client |
217 | { | 217 | /// </summary> |
218 | terrModule.PushTerrain(RemoteClient); | 218 | /// <param name="RemoteClient">Client to send to</param> |
219 | } | 219 | public virtual void SendLayerData(IClientAPI RemoteClient) |
220 | } | 220 | { |
221 | 221 | // RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); | |
222 | #endregion | 222 | ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>(); |
223 | 223 | if (terrModule != null) | |
224 | #region Add/Remove Agent/Avatar | 224 | { |
225 | 225 | terrModule.PushTerrain(RemoteClient); | |
226 | public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); | 226 | } |
227 | 227 | } | |
228 | public abstract bool CloseAgent(UUID agentID, bool force); | 228 | |
229 | 229 | #endregion | |
230 | public bool TryGetScenePresence(UUID agentID, out object scenePresence) | 230 | |
231 | { | 231 | #region Add/Remove Agent/Avatar |
232 | scenePresence = null; | 232 | |
233 | ScenePresence sp = null; | 233 | public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); |
234 | if (TryGetScenePresence(agentID, out sp)) | 234 | |
235 | { | 235 | public abstract bool CloseAgent(UUID agentID, bool force); |
236 | scenePresence = sp; | 236 | |
237 | return true; | 237 | public bool TryGetScenePresence(UUID agentID, out object scenePresence) |
238 | } | 238 | { |
239 | 239 | scenePresence = null; | |
240 | return false; | 240 | ScenePresence sp = null; |
241 | } | 241 | if (TryGetScenePresence(agentID, out sp)) |
242 | 242 | { | |
243 | /// <summary> | 243 | scenePresence = sp; |
244 | /// Try to get a scene presence from the scene | 244 | return true; |
245 | /// </summary> | 245 | } |
246 | /// <param name="agentID"></param> | 246 | |
247 | /// <param name="scenePresence">null if there is no scene presence with the given agent id</param> | 247 | return false; |
248 | /// <returns>true if there was a scene presence with the given id, false otherwise.</returns> | 248 | } |
249 | public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); | 249 | |
250 | 250 | /// <summary> | |
251 | #endregion | 251 | /// Try to get a scene presence from the scene |
252 | 252 | /// </summary> | |
253 | /// <summary> | 253 | /// <param name="agentID"></param> |
254 | /// | 254 | /// <param name="scenePresence">null if there is no scene presence with the given agent id</param> |
255 | /// </summary> | 255 | /// <returns>true if there was a scene presence with the given id, false otherwise.</returns> |
256 | /// <returns></returns> | 256 | public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); |
257 | public virtual RegionInfo RegionInfo { get; private set; } | 257 | |
258 | 258 | #endregion | |
259 | #region admin stuff | 259 | |
260 | 260 | /// <summary> | |
261 | public abstract void OtherRegionUp(GridRegion otherRegion); | 261 | /// |
262 | 262 | /// </summary> | |
263 | public virtual string GetSimulatorVersion() | 263 | /// <returns></returns> |
264 | { | 264 | public virtual RegionInfo RegionInfo { get; private set; } |
265 | return "OpenSimulator Server"; | 265 | |
266 | } | 266 | #region admin stuff |
267 | 267 | ||
268 | #endregion | 268 | public abstract void OtherRegionUp(GridRegion otherRegion); |
269 | 269 | ||
270 | #region Shutdown | 270 | public virtual string GetSimulatorVersion() |
271 | 271 | { | |
272 | /// <summary> | 272 | return "OpenSimulator Server"; |
273 | /// Tidy before shutdown | 273 | } |
274 | /// </summary> | 274 | |
275 | public virtual void Close() | 275 | #endregion |
276 | { | 276 | |
277 | try | 277 | #region Shutdown |
278 | { | 278 | |
279 | EventManager.TriggerShutdown(); | 279 | /// <summary> |
280 | } | 280 | /// Tidy before shutdown |
281 | catch (Exception e) | 281 | /// </summary> |
282 | { | 282 | public virtual void Close() |
283 | m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); | 283 | { |
284 | } | 284 | try |
285 | } | 285 | { |
286 | 286 | EventManager.TriggerShutdown(); | |
287 | #endregion | 287 | } |
288 | 288 | catch (Exception e) | |
289 | /// <summary> | 289 | { |
290 | /// Returns a new unallocated local ID | 290 | m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); |
291 | /// </summary> | 291 | } |
292 | /// <returns>A brand new local ID</returns> | 292 | } |
293 | public uint AllocateLocalId() | 293 | |
294 | { | 294 | #endregion |
295 | uint myID; | 295 | |
296 | 296 | /// <summary> | |
297 | _primAllocateMutex.WaitOne(); | 297 | /// Returns a new unallocated local ID |
298 | myID = ++m_lastAllocatedLocalId; | 298 | /// </summary> |
299 | _primAllocateMutex.ReleaseMutex(); | 299 | /// <returns>A brand new local ID</returns> |
300 | 300 | public uint AllocateLocalId() | |
301 | return myID; | 301 | { |
302 | } | 302 | uint myID; |
303 | 303 | ||
304 | public uint AllocatePresenceLocalId() | 304 | _primAllocateMutex.WaitOne(); |
305 | { | 305 | myID = ++m_lastAllocatedLocalId; |
306 | uint myID; | 306 | _primAllocateMutex.ReleaseMutex(); |
307 | 307 | ||
308 | _primAllocateMutex.WaitOne(); | 308 | return myID; |
309 | myID = ++m_lastAllocatedLocalId; | 309 | } |
310 | ++m_lastAllocatedLocalId; | 310 | |
311 | _primAllocateMutex.ReleaseMutex(); | 311 | #region Module Methods |
312 | 312 | ||
313 | return myID; | 313 | /// <summary> |
314 | } | 314 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. |
315 | 315 | /// </summary> | |
316 | #region Module Methods | 316 | /// <param name="name"></param> |
317 | 317 | /// <param name="module"></param> | |
318 | /// <summary> | 318 | public void AddRegionModule(string name, IRegionModuleBase module) |
319 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. | 319 | { |
320 | /// </summary> | 320 | if (!RegionModules.ContainsKey(name)) |
321 | /// <param name="name"></param> | 321 | { |
322 | /// <param name="module"></param> | 322 | RegionModules.Add(name, module); |
323 | public void AddRegionModule(string name, IRegionModuleBase module) | 323 | } |
324 | { | 324 | } |
325 | if (!RegionModules.ContainsKey(name)) | 325 | |
326 | { | 326 | public void RemoveRegionModule(string name) |
327 | RegionModules.Add(name, module); | 327 | { |
328 | } | 328 | RegionModules.Remove(name); |
329 | } | 329 | } |
330 | 330 | ||
331 | public void RemoveRegionModule(string name) | 331 | /// <summary> |
332 | { | 332 | /// Register a module commander. |
333 | RegionModules.Remove(name); | 333 | /// </summary> |
334 | } | 334 | /// <param name="commander"></param> |
335 | 335 | public void RegisterModuleCommander(ICommander commander) | |
336 | /// <summary> | 336 | { |
337 | /// Register a module commander. | 337 | lock (m_moduleCommanders) |
338 | /// </summary> | 338 | { |
339 | /// <param name="commander"></param> | 339 | m_moduleCommanders.Add(commander.Name, commander); |
340 | public void RegisterModuleCommander(ICommander commander) | 340 | } |
341 | { | 341 | } |
342 | lock (m_moduleCommanders) | 342 | |
343 | { | 343 | /// <summary> |
344 | m_moduleCommanders.Add(commander.Name, commander); | 344 | /// Unregister a module commander and all its commands |
345 | } | 345 | /// </summary> |
346 | } | 346 | /// <param name="name"></param> |
347 | 347 | public void UnregisterModuleCommander(string name) | |
348 | /// <summary> | 348 | { |
349 | /// Unregister a module commander and all its commands | 349 | lock (m_moduleCommanders) |
350 | /// </summary> | 350 | { |
351 | /// <param name="name"></param> | 351 | ICommander commander; |
352 | public void UnregisterModuleCommander(string name) | 352 | if (m_moduleCommanders.TryGetValue(name, out commander)) |
353 | { | 353 | m_moduleCommanders.Remove(name); |
354 | lock (m_moduleCommanders) | 354 | } |
355 | { | 355 | } |
356 | ICommander commander; | 356 | |
357 | if (m_moduleCommanders.TryGetValue(name, out commander)) | 357 | /// <summary> |
358 | m_moduleCommanders.Remove(name); | 358 | /// Get a module commander |
359 | } | 359 | /// </summary> |
360 | } | 360 | /// <param name="name"></param> |
361 | 361 | /// <returns>The module commander, null if no module commander with that name was found</returns> | |
362 | /// <summary> | 362 | public ICommander GetCommander(string name) |
363 | /// Get a module commander | 363 | { |
364 | /// </summary> | 364 | lock (m_moduleCommanders) |
365 | /// <param name="name"></param> | 365 | { |
366 | /// <returns>The module commander, null if no module commander with that name was found</returns> | 366 | if (m_moduleCommanders.ContainsKey(name)) |
367 | public ICommander GetCommander(string name) | 367 | return m_moduleCommanders[name]; |
368 | { | 368 | } |
369 | lock (m_moduleCommanders) | 369 | |
370 | { | 370 | return null; |
371 | if (m_moduleCommanders.ContainsKey(name)) | 371 | } |
372 | return m_moduleCommanders[name]; | 372 | |
373 | } | 373 | public Dictionary<string, ICommander> GetCommanders() |
374 | 374 | { | |
375 | return null; | 375 | return m_moduleCommanders; |
376 | } | 376 | } |
377 | 377 | ||
378 | public Dictionary<string, ICommander> GetCommanders() | 378 | public List<UUID> GetFormatsOffered() |
379 | { | 379 | { |
380 | return m_moduleCommanders; | 380 | List<UUID> ret = new List<UUID>(FormatsOffered); |
381 | } | 381 | |
382 | 382 | return ret; | |
383 | /// <summary> | 383 | } |
384 | /// Register an interface to a region module. This allows module methods to be called directly as | 384 | |
385 | /// well as via events. If there is already a module registered for this interface, it is not replaced | 385 | protected void CheckAndAddAgentDataFormats(object mod) |
386 | /// (is this the best behaviour?) | 386 | { |
387 | /// </summary> | 387 | if (!(mod is IAgentStatefulModule)) |
388 | /// <param name="mod"></param> | 388 | return; |
389 | public void RegisterModuleInterface<M>(M mod) | 389 | |
390 | { | 390 | IAgentStatefulModule m = (IAgentStatefulModule)mod; |
391 | // m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); | 391 | |
392 | 392 | List<UUID> renderFormats = m.GetRenderStateFormats(); | |
393 | List<Object> l = null; | 393 | List<UUID> acceptFormats = m.GetAcceptStateFormats(); |
394 | if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) | 394 | |
395 | { | 395 | foreach (UUID render in renderFormats) |
396 | l = new List<Object>(); | 396 | { |
397 | ModuleInterfaces.Add(typeof(M), l); | 397 | if (!(FormatsOffered.Contains(render))) |
398 | } | 398 | FormatsOffered.Add(render); |
399 | 399 | } | |
400 | if (l.Count > 0) | 400 | |
401 | return; | 401 | if (acceptFormats.Count == 0) |
402 | 402 | return; | |
403 | l.Add(mod); | 403 | |
404 | 404 | if (FormatsWanted.ContainsKey(mod)) | |
405 | if (mod is IEntityCreator) | 405 | return; |
406 | { | 406 | |
407 | IEntityCreator entityCreator = (IEntityCreator)mod; | 407 | FormatsWanted[mod] = acceptFormats; |
408 | foreach (PCode pcode in entityCreator.CreationCapabilities) | 408 | } |
409 | { | 409 | |
410 | m_entityCreators[pcode] = entityCreator; | 410 | /// <summary> |
411 | } | 411 | /// Register an interface to a region module. This allows module methods to be called directly as |
412 | } | 412 | /// well as via events. If there is already a module registered for this interface, it is not replaced |
413 | } | 413 | /// (is this the best behaviour?) |
414 | 414 | /// </summary> | |
415 | public void UnregisterModuleInterface<M>(M mod) | 415 | /// <param name="mod"></param> |
416 | { | 416 | public void RegisterModuleInterface<M>(M mod) |
417 | List<Object> l; | 417 | { |
418 | if (ModuleInterfaces.TryGetValue(typeof(M), out l)) | 418 | // m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); |
419 | { | 419 | |
420 | if (l.Remove(mod)) | 420 | List<Object> l = null; |
421 | { | 421 | if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) |
422 | if (mod is IEntityCreator) | 422 | { |
423 | { | 423 | l = new List<Object>(); |
424 | IEntityCreator entityCreator = (IEntityCreator)mod; | 424 | ModuleInterfaces.Add(typeof(M), l); |
425 | foreach (PCode pcode in entityCreator.CreationCapabilities) | 425 | } |
426 | { | 426 | |
427 | m_entityCreators[pcode] = null; | 427 | if (l.Count > 0) |
428 | } | 428 | return; |
429 | } | 429 | |
430 | } | 430 | l.Add(mod); |
431 | } | 431 | |
432 | } | 432 | CheckAndAddAgentDataFormats(mod); |
433 | 433 | ||
434 | public void StackModuleInterface<M>(M mod) | 434 | if (mod is IEntityCreator) |
435 | { | 435 | { |
436 | List<Object> l; | 436 | IEntityCreator entityCreator = (IEntityCreator)mod; |
437 | if (ModuleInterfaces.ContainsKey(typeof(M))) | 437 | foreach (PCode pcode in entityCreator.CreationCapabilities) |
438 | l = ModuleInterfaces[typeof(M)]; | 438 | { |
439 | else | 439 | m_entityCreators[pcode] = entityCreator; |
440 | l = new List<Object>(); | 440 | } |
441 | 441 | } | |
442 | if (l.Contains(mod)) | 442 | } |
443 | return; | 443 | |
444 | 444 | public void UnregisterModuleInterface<M>(M mod) | |
445 | l.Add(mod); | 445 | { |
446 | 446 | // We can't unregister agent stateful modules because | |
447 | if (mod is IEntityCreator) | 447 | // that would require much more data to be held about formats |
448 | { | 448 | // and would make that code slower and less efficient. |
449 | IEntityCreator entityCreator = (IEntityCreator)mod; | 449 | // No known modules are unregistered anyway, ever, unless |
450 | foreach (PCode pcode in entityCreator.CreationCapabilities) | 450 | // the simulator shuts down anyway. |
451 | { | 451 | if (mod is IAgentStatefulModule) |
452 | m_entityCreators[pcode] = entityCreator; | 452 | return; |
453 | } | 453 | |
454 | } | 454 | List<Object> l; |
455 | 455 | if (ModuleInterfaces.TryGetValue(typeof(M), out l)) | |
456 | ModuleInterfaces[typeof(M)] = l; | 456 | { |
457 | } | 457 | if (l.Remove(mod)) |
458 | 458 | { | |
459 | /// <summary> | 459 | if (mod is IEntityCreator) |
460 | /// For the given interface, retrieve the region module which implements it. | 460 | { |
461 | /// </summary> | 461 | IEntityCreator entityCreator = (IEntityCreator)mod; |
462 | /// <returns>null if there is no registered module implementing that interface</returns> | 462 | foreach (PCode pcode in entityCreator.CreationCapabilities) |
463 | public T RequestModuleInterface<T>() | 463 | { |
464 | { | 464 | m_entityCreators[pcode] = null; |
465 | if (ModuleInterfaces.ContainsKey(typeof(T)) && | 465 | } |
466 | (ModuleInterfaces[typeof(T)].Count > 0)) | 466 | } |
467 | return (T)ModuleInterfaces[typeof(T)][0]; | 467 | } |
468 | else | 468 | } |
469 | return default(T); | 469 | } |
470 | } | 470 | |
471 | 471 | public void StackModuleInterface<M>(M mod) | |
472 | /// <summary> | 472 | { |
473 | /// For the given interface, retrieve an array of region modules that implement it. | 473 | List<Object> l; |
474 | /// </summary> | 474 | if (ModuleInterfaces.ContainsKey(typeof(M))) |
475 | /// <returns>an empty array if there are no registered modules implementing that interface</returns> | 475 | l = ModuleInterfaces[typeof(M)]; |
476 | public T[] RequestModuleInterfaces<T>() | 476 | else |
477 | { | 477 | l = new List<Object>(); |
478 | if (ModuleInterfaces.ContainsKey(typeof(T))) | 478 | |
479 | { | 479 | if (l.Contains(mod)) |
480 | List<T> ret = new List<T>(); | 480 | return; |
481 | 481 | ||
482 | foreach (Object o in ModuleInterfaces[typeof(T)]) | 482 | l.Add(mod); |
483 | ret.Add((T)o); | 483 | |
484 | return ret.ToArray(); | 484 | CheckAndAddAgentDataFormats(mod); |
485 | } | 485 | |
486 | else | 486 | if (mod is IEntityCreator) |
487 | { | 487 | { |
488 | return new T[] {}; | 488 | IEntityCreator entityCreator = (IEntityCreator)mod; |
489 | } | 489 | foreach (PCode pcode in entityCreator.CreationCapabilities) |
490 | } | 490 | { |
491 | 491 | m_entityCreators[pcode] = entityCreator; | |
492 | #endregion | 492 | } |
493 | 493 | } | |
494 | /// <summary> | 494 | |
495 | /// Call this from a region module to add a command to the OpenSim console. | 495 | ModuleInterfaces[typeof(M)] = l; |
496 | /// </summary> | 496 | } |
497 | /// <param name="mod"></param> | 497 | |
498 | /// <param name="command"></param> | 498 | /// <summary> |
499 | /// <param name="shorthelp"></param> | 499 | /// For the given interface, retrieve the region module which implements it. |
500 | /// <param name="longhelp"></param> | 500 | /// </summary> |
501 | /// <param name="callback"></param> | 501 | /// <returns>null if there is no registered module implementing that interface</returns> |
502 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) | 502 | public T RequestModuleInterface<T>() |
503 | { | 503 | { |
504 | AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); | 504 | if (ModuleInterfaces.ContainsKey(typeof(T)) && |
505 | } | 505 | (ModuleInterfaces[typeof(T)].Count > 0)) |
506 | 506 | return (T)ModuleInterfaces[typeof(T)][0]; | |
507 | /// <summary> | 507 | else |
508 | /// Call this from a region module to add a command to the OpenSim console. | 508 | return default(T); |
509 | /// </summary> | 509 | } |
510 | /// <param name="mod"> | 510 | |
511 | /// The use of IRegionModuleBase is a cheap trick to get a different method signature, | 511 | /// <summary> |
512 | /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. | 512 | /// For the given interface, retrieve an array of region modules that implement it. |
513 | /// </param> | 513 | /// </summary> |
514 | /// <param name="category"> | 514 | /// <returns>an empty array if there are no registered modules implementing that interface</returns> |
515 | /// Category of the command. This is the section under which it will appear when the user asks for help | 515 | public T[] RequestModuleInterfaces<T>() |
516 | /// </param> | 516 | { |
517 | /// <param name="command"></param> | 517 | if (ModuleInterfaces.ContainsKey(typeof(T))) |
518 | /// <param name="shorthelp"></param> | 518 | { |
519 | /// <param name="longhelp"></param> | 519 | List<T> ret = new List<T>(); |
520 | /// <param name="callback"></param> | 520 | |
521 | public void AddCommand( | 521 | foreach (Object o in ModuleInterfaces[typeof(T)]) |
522 | string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) | 522 | ret.Add((T)o); |
523 | { | 523 | return ret.ToArray(); |
524 | AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); | 524 | } |
525 | } | 525 | else |
526 | 526 | { | |
527 | /// <summary> | 527 | return new T[] {}; |
528 | /// Call this from a region module to add a command to the OpenSim console. | 528 | } |
529 | /// </summary> | 529 | } |
530 | /// <param name="mod"></param> | 530 | |
531 | /// <param name="command"></param> | 531 | #endregion |
532 | /// <param name="shorthelp"></param> | 532 | |
533 | /// <param name="longhelp"></param> | 533 | /// <summary> |
534 | /// <param name="descriptivehelp"></param> | 534 | /// Call this from a region module to add a command to the OpenSim console. |
535 | /// <param name="callback"></param> | 535 | /// </summary> |
536 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 536 | /// <param name="mod"></param> |
537 | { | 537 | /// <param name="command"></param> |
538 | string moduleName = ""; | 538 | /// <param name="shorthelp"></param> |
539 | 539 | /// <param name="longhelp"></param> | |
540 | if (module != null) | 540 | /// <param name="callback"></param> |
541 | moduleName = module.Name; | 541 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
542 | 542 | { | |
543 | AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); | 543 | AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); |
544 | } | 544 | } |
545 | 545 | ||
546 | /// <summary> | 546 | /// <summary> |
547 | /// Call this from a region module to add a command to the OpenSim console. | 547 | /// Call this from a region module to add a command to the OpenSim console. |
548 | /// </summary> | 548 | /// </summary> |
549 | /// <param name="category"> | 549 | /// <param name="mod"> |
550 | /// Category of the command. This is the section under which it will appear when the user asks for help | 550 | /// The use of IRegionModuleBase is a cheap trick to get a different method signature, |
551 | /// </param> | 551 | /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. |
552 | /// <param name="mod"></param> | 552 | /// </param> |
553 | /// <param name="command"></param> | 553 | /// <param name="category"> |
554 | /// <param name="shorthelp"></param> | 554 | /// Category of the command. This is the section under which it will appear when the user asks for help |
555 | /// <param name="longhelp"></param> | 555 | /// </param> |
556 | /// <param name="descriptivehelp"></param> | 556 | /// <param name="command"></param> |
557 | /// <param name="callback"></param> | 557 | /// <param name="shorthelp"></param> |
558 | public void AddCommand( | 558 | /// <param name="longhelp"></param> |
559 | string category, IRegionModuleBase module, string command, | 559 | /// <param name="callback"></param> |
560 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 560 | public void AddCommand( |
561 | { | 561 | string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
562 | if (MainConsole.Instance == null) | 562 | { |
563 | return; | 563 | AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); |
564 | 564 | } | |
565 | bool shared = false; | 565 | |
566 | 566 | /// <summary> | |
567 | if (module != null) | 567 | /// Call this from a region module to add a command to the OpenSim console. |
568 | shared = module is ISharedRegionModule; | 568 | /// </summary> |
569 | 569 | /// <param name="mod"></param> | |
570 | MainConsole.Instance.Commands.AddCommand( | 570 | /// <param name="command"></param> |
571 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); | 571 | /// <param name="shorthelp"></param> |
572 | } | 572 | /// <param name="longhelp"></param> |
573 | 573 | /// <param name="descriptivehelp"></param> | |
574 | public virtual ISceneObject DeserializeObject(string representation) | 574 | /// <param name="callback"></param> |
575 | { | 575 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
576 | return null; | 576 | { |
577 | } | 577 | string moduleName = ""; |
578 | 578 | ||
579 | public virtual bool AllowScriptCrossings | 579 | if (module != null) |
580 | { | 580 | moduleName = module.Name; |
581 | get { return false; } | 581 | |
582 | } | 582 | AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); |
583 | 583 | } | |
584 | public virtual void Start() | 584 | |
585 | { | 585 | /// <summary> |
586 | } | 586 | /// Call this from a region module to add a command to the OpenSim console. |
587 | 587 | /// </summary> | |
588 | public void Restart() | 588 | /// <param name="category"> |
589 | { | 589 | /// Category of the command. This is the section under which it will appear when the user asks for help |
590 | // This has to be here to fire the event | 590 | /// </param> |
591 | restart handlerPhysicsCrash = OnRestart; | 591 | /// <param name="mod"></param> |
592 | if (handlerPhysicsCrash != null) | 592 | /// <param name="command"></param> |
593 | handlerPhysicsCrash(RegionInfo); | 593 | /// <param name="shorthelp"></param> |
594 | } | 594 | /// <param name="longhelp"></param> |
595 | 595 | /// <param name="descriptivehelp"></param> | |
596 | public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); | 596 | /// <param name="callback"></param> |
597 | } | 597 | public void AddCommand( |
598 | } | 598 | string category, IRegionModuleBase module, string command, |
599 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | ||
600 | { | ||
601 | if (MainConsole.Instance == null) | ||
602 | return; | ||
603 | |||
604 | bool shared = false; | ||
605 | |||
606 | if (module != null) | ||
607 | shared = module is ISharedRegionModule; | ||
608 | |||
609 | MainConsole.Instance.Commands.AddCommand( | ||
610 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); | ||
611 | } | ||
612 | |||
613 | public virtual ISceneObject DeserializeObject(string representation) | ||
614 | { | ||
615 | return null; | ||
616 | } | ||
617 | |||
618 | public virtual bool AllowScriptCrossings | ||
619 | { | ||
620 | get { return false; } | ||
621 | } | ||
622 | |||
623 | public virtual void Start() | ||
624 | { | ||
625 | } | ||
626 | |||
627 | public void Restart() | ||
628 | { | ||
629 | // This has to be here to fire the event | ||
630 | restart handlerPhysicsCrash = OnRestart; | ||
631 | if (handlerPhysicsCrash != null) | ||
632 | handlerPhysicsCrash(RegionInfo); | ||
633 | } | ||
634 | |||
635 | public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); | ||
636 | } | ||
637 | } | ||
638 | ======= | ||
639 | /* | ||
640 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
641 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
642 | * | ||
643 | * Redistribution and use in source and binary forms, with or without | ||
644 | * modification, are permitted provided that the following conditions are met: | ||
645 | * * Redistributions of source code must retain the above copyright | ||
646 | * notice, this list of conditions and the following disclaimer. | ||
647 | * * Redistributions in binary form must reproduce the above copyright | ||
648 | * notice, this list of conditions and the following disclaimer in the | ||
649 | * documentation and/or other materials provided with the distribution. | ||
650 | * * Neither the name of the OpenSimulator Project nor the | ||
651 | * names of its contributors may be used to endorse or promote products | ||
652 | * derived from this software without specific prior written permission. | ||
653 | * | ||
654 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
655 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
656 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
657 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
658 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
659 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
660 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
661 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
662 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
663 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
664 | */ | ||
665 | |||
666 | using System; | ||
667 | using System.Collections.Generic; | ||
668 | using System.Reflection; | ||
669 | using System.Threading; | ||
670 | using OpenMetaverse; | ||
671 | using log4net; | ||
672 | using Nini.Config; | ||
673 | using OpenSim.Framework; | ||
674 | using OpenSim.Framework.Console; | ||
675 | |||
676 | using OpenSim.Region.Framework.Interfaces; | ||
677 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
678 | |||
679 | namespace OpenSim.Region.Framework.Scenes | ||
680 | { | ||
681 | public abstract class SceneBase : IScene | ||
682 | { | ||
683 | protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
684 | protected static readonly string LogHeader = "[SCENE]"; | ||
685 | |||
686 | #region Events | ||
687 | |||
688 | public event restart OnRestart; | ||
689 | |||
690 | #endregion | ||
691 | |||
692 | #region Fields | ||
693 | |||
694 | public string Name { get { return RegionInfo.RegionName; } } | ||
695 | |||
696 | public IConfigSource Config | ||
697 | { | ||
698 | get { return GetConfig(); } | ||
699 | } | ||
700 | |||
701 | protected virtual IConfigSource GetConfig() | ||
702 | { | ||
703 | return null; | ||
704 | } | ||
705 | |||
706 | /// <value> | ||
707 | /// All the region modules attached to this scene. | ||
708 | /// </value> | ||
709 | public Dictionary<string, IRegionModuleBase> RegionModules | ||
710 | { | ||
711 | get { return m_regionModules; } | ||
712 | } | ||
713 | private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>(); | ||
714 | |||
715 | /// <value> | ||
716 | /// The module interfaces available from this scene. | ||
717 | /// </value> | ||
718 | protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); | ||
719 | |||
720 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | ||
721 | |||
722 | /// <value> | ||
723 | /// The module commanders available from this scene | ||
724 | /// </value> | ||
725 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); | ||
726 | |||
727 | /// <value> | ||
728 | /// Registered classes that are capable of creating entities. | ||
729 | /// </value> | ||
730 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | ||
731 | |||
732 | /// <summary> | ||
733 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is | ||
734 | /// dispensed. | ||
735 | /// </summary> | ||
736 | protected uint m_lastAllocatedLocalId = 720000; | ||
737 | |||
738 | private readonly Mutex _primAllocateMutex = new Mutex(false); | ||
739 | |||
740 | protected readonly ClientManager m_clientManager = new ClientManager(); | ||
741 | |||
742 | public bool LoginsEnabled | ||
743 | { | ||
744 | get | ||
745 | { | ||
746 | return m_loginsEnabled; | ||
747 | } | ||
748 | |||
749 | set | ||
750 | { | ||
751 | if (m_loginsEnabled != value) | ||
752 | { | ||
753 | m_loginsEnabled = value; | ||
754 | EventManager.TriggerRegionLoginsStatusChange(this); | ||
755 | } | ||
756 | } | ||
757 | } | ||
758 | private bool m_loginsEnabled; | ||
759 | |||
760 | public bool Ready | ||
761 | { | ||
762 | get | ||
763 | { | ||
764 | return m_ready; | ||
765 | } | ||
766 | |||
767 | set | ||
768 | { | ||
769 | if (m_ready != value) | ||
770 | { | ||
771 | m_ready = value; | ||
772 | EventManager.TriggerRegionReadyStatusChange(this); | ||
773 | } | ||
774 | } | ||
775 | } | ||
776 | private bool m_ready; | ||
777 | |||
778 | public float TimeDilation | ||
779 | { | ||
780 | get { return 1.0f; } | ||
781 | } | ||
782 | |||
783 | protected ulong m_regionHandle; | ||
784 | protected string m_regionName; | ||
785 | |||
786 | public ITerrainChannel Heightmap; | ||
787 | |||
788 | /// <value> | ||
789 | /// Allows retrieval of land information for this scene. | ||
790 | /// </value> | ||
791 | public ILandChannel LandChannel; | ||
792 | |||
793 | /// <value> | ||
794 | /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules | ||
795 | /// to subscribe to scene events. | ||
796 | /// </value> | ||
797 | public EventManager EventManager | ||
798 | { | ||
799 | get { return m_eventManager; } | ||
800 | } | ||
801 | protected EventManager m_eventManager; | ||
802 | |||
803 | protected ScenePermissions m_permissions; | ||
804 | public ScenePermissions Permissions | ||
805 | { | ||
806 | get { return m_permissions; } | ||
807 | } | ||
808 | |||
809 | protected string m_datastore; | ||
810 | |||
811 | /* Used by the loadbalancer plugin on GForge */ | ||
812 | protected RegionStatus m_regStatus; | ||
813 | public RegionStatus RegionStatus | ||
814 | { | ||
815 | get { return m_regStatus; } | ||
816 | set { m_regStatus = value; } | ||
817 | } | ||
818 | |||
819 | #endregion | ||
820 | |||
821 | public SceneBase(RegionInfo regInfo) | ||
822 | { | ||
823 | RegionInfo = regInfo; | ||
824 | } | ||
825 | |||
826 | #region Update Methods | ||
827 | |||
828 | /// <summary> | ||
829 | /// Called to update the scene loop by a number of frames and until shutdown. | ||
830 | /// </summary> | ||
831 | /// <param name="frames"> | ||
832 | /// Number of frames to update. Exits on shutdown even if there are frames remaining. | ||
833 | /// If -1 then updates until shutdown. | ||
834 | /// </param> | ||
835 | public abstract void Update(int frames); | ||
836 | |||
837 | #endregion | ||
838 | |||
839 | #region Terrain Methods | ||
840 | |||
841 | /// <summary> | ||
842 | /// Loads the World heightmap | ||
843 | /// </summary> | ||
844 | public abstract void LoadWorldMap(); | ||
845 | |||
846 | /// <summary> | ||
847 | /// Send the region heightmap to the client | ||
848 | /// </summary> | ||
849 | /// <param name="RemoteClient">Client to send to</param> | ||
850 | public virtual void SendLayerData(IClientAPI RemoteClient) | ||
851 | { | ||
852 | // RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); | ||
853 | ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>(); | ||
854 | if (terrModule != null) | ||
855 | { | ||
856 | terrModule.PushTerrain(RemoteClient); | ||
857 | } | ||
858 | } | ||
859 | |||
860 | #endregion | ||
861 | |||
862 | #region Add/Remove Agent/Avatar | ||
863 | |||
864 | public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); | ||
865 | |||
866 | public abstract bool CloseAgent(UUID agentID, bool force); | ||
867 | |||
868 | public bool TryGetScenePresence(UUID agentID, out object scenePresence) | ||
869 | { | ||
870 | scenePresence = null; | ||
871 | ScenePresence sp = null; | ||
872 | if (TryGetScenePresence(agentID, out sp)) | ||
873 | { | ||
874 | scenePresence = sp; | ||
875 | return true; | ||
876 | } | ||
877 | |||
878 | return false; | ||
879 | } | ||
880 | |||
881 | /// <summary> | ||
882 | /// Try to get a scene presence from the scene | ||
883 | /// </summary> | ||
884 | /// <param name="agentID"></param> | ||
885 | /// <param name="scenePresence">null if there is no scene presence with the given agent id</param> | ||
886 | /// <returns>true if there was a scene presence with the given id, false otherwise.</returns> | ||
887 | public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); | ||
888 | |||
889 | #endregion | ||
890 | |||
891 | /// <summary> | ||
892 | /// | ||
893 | /// </summary> | ||
894 | /// <returns></returns> | ||
895 | public virtual RegionInfo RegionInfo { get; private set; } | ||
896 | |||
897 | #region admin stuff | ||
898 | |||
899 | public abstract void OtherRegionUp(GridRegion otherRegion); | ||
900 | |||
901 | public virtual string GetSimulatorVersion() | ||
902 | { | ||
903 | return "OpenSimulator Server"; | ||
904 | } | ||
905 | |||
906 | #endregion | ||
907 | |||
908 | #region Shutdown | ||
909 | |||
910 | /// <summary> | ||
911 | /// Tidy before shutdown | ||
912 | /// </summary> | ||
913 | public virtual void Close() | ||
914 | { | ||
915 | try | ||
916 | { | ||
917 | EventManager.TriggerShutdown(); | ||
918 | } | ||
919 | catch (Exception e) | ||
920 | { | ||
921 | m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); | ||
922 | } | ||
923 | } | ||
924 | |||
925 | #endregion | ||
926 | |||
927 | /// <summary> | ||
928 | /// Returns a new unallocated local ID | ||
929 | /// </summary> | ||
930 | /// <returns>A brand new local ID</returns> | ||
931 | public uint AllocateLocalId() | ||
932 | { | ||
933 | uint myID; | ||
934 | |||
935 | _primAllocateMutex.WaitOne(); | ||
936 | myID = ++m_lastAllocatedLocalId; | ||
937 | _primAllocateMutex.ReleaseMutex(); | ||
938 | |||
939 | return myID; | ||
940 | } | ||
941 | |||
942 | public uint AllocatePresenceLocalId() | ||
943 | { | ||
944 | uint myID; | ||
945 | |||
946 | _primAllocateMutex.WaitOne(); | ||
947 | myID = ++m_lastAllocatedLocalId; | ||
948 | ++m_lastAllocatedLocalId; | ||
949 | _primAllocateMutex.ReleaseMutex(); | ||
950 | |||
951 | return myID; | ||
952 | } | ||
953 | |||
954 | #region Module Methods | ||
955 | |||
956 | /// <summary> | ||
957 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. | ||
958 | /// </summary> | ||
959 | /// <param name="name"></param> | ||
960 | /// <param name="module"></param> | ||
961 | public void AddRegionModule(string name, IRegionModuleBase module) | ||
962 | { | ||
963 | if (!RegionModules.ContainsKey(name)) | ||
964 | { | ||
965 | RegionModules.Add(name, module); | ||
966 | } | ||
967 | } | ||
968 | |||
969 | public void RemoveRegionModule(string name) | ||
970 | { | ||
971 | RegionModules.Remove(name); | ||
972 | } | ||
973 | |||
974 | /// <summary> | ||
975 | /// Register a module commander. | ||
976 | /// </summary> | ||
977 | /// <param name="commander"></param> | ||
978 | public void RegisterModuleCommander(ICommander commander) | ||
979 | { | ||
980 | lock (m_moduleCommanders) | ||
981 | { | ||
982 | m_moduleCommanders.Add(commander.Name, commander); | ||
983 | } | ||
984 | } | ||
985 | |||
986 | /// <summary> | ||
987 | /// Unregister a module commander and all its commands | ||
988 | /// </summary> | ||
989 | /// <param name="name"></param> | ||
990 | public void UnregisterModuleCommander(string name) | ||
991 | { | ||
992 | lock (m_moduleCommanders) | ||
993 | { | ||
994 | ICommander commander; | ||
995 | if (m_moduleCommanders.TryGetValue(name, out commander)) | ||
996 | m_moduleCommanders.Remove(name); | ||
997 | } | ||
998 | } | ||
999 | |||
1000 | /// <summary> | ||
1001 | /// Get a module commander | ||
1002 | /// </summary> | ||
1003 | /// <param name="name"></param> | ||
1004 | /// <returns>The module commander, null if no module commander with that name was found</returns> | ||
1005 | public ICommander GetCommander(string name) | ||
1006 | { | ||
1007 | lock (m_moduleCommanders) | ||
1008 | { | ||
1009 | if (m_moduleCommanders.ContainsKey(name)) | ||
1010 | return m_moduleCommanders[name]; | ||
1011 | } | ||
1012 | |||
1013 | return null; | ||
1014 | } | ||
1015 | |||
1016 | public Dictionary<string, ICommander> GetCommanders() | ||
1017 | { | ||
1018 | return m_moduleCommanders; | ||
1019 | } | ||
1020 | |||
1021 | /// <summary> | ||
1022 | /// Register an interface to a region module. This allows module methods to be called directly as | ||
1023 | /// well as via events. If there is already a module registered for this interface, it is not replaced | ||
1024 | /// (is this the best behaviour?) | ||
1025 | /// </summary> | ||
1026 | /// <param name="mod"></param> | ||
1027 | public void RegisterModuleInterface<M>(M mod) | ||
1028 | { | ||
1029 | // m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); | ||
1030 | |||
1031 | List<Object> l = null; | ||
1032 | if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) | ||
1033 | { | ||
1034 | l = new List<Object>(); | ||
1035 | ModuleInterfaces.Add(typeof(M), l); | ||
1036 | } | ||
1037 | |||
1038 | if (l.Count > 0) | ||
1039 | return; | ||
1040 | |||
1041 | l.Add(mod); | ||
1042 | |||
1043 | if (mod is IEntityCreator) | ||
1044 | { | ||
1045 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
1046 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
1047 | { | ||
1048 | m_entityCreators[pcode] = entityCreator; | ||
1049 | } | ||
1050 | } | ||
1051 | } | ||
1052 | |||
1053 | public void UnregisterModuleInterface<M>(M mod) | ||
1054 | { | ||
1055 | List<Object> l; | ||
1056 | if (ModuleInterfaces.TryGetValue(typeof(M), out l)) | ||
1057 | { | ||
1058 | if (l.Remove(mod)) | ||
1059 | { | ||
1060 | if (mod is IEntityCreator) | ||
1061 | { | ||
1062 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
1063 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
1064 | { | ||
1065 | m_entityCreators[pcode] = null; | ||
1066 | } | ||
1067 | } | ||
1068 | } | ||
1069 | } | ||
1070 | } | ||
1071 | |||
1072 | public void StackModuleInterface<M>(M mod) | ||
1073 | { | ||
1074 | List<Object> l; | ||
1075 | if (ModuleInterfaces.ContainsKey(typeof(M))) | ||
1076 | l = ModuleInterfaces[typeof(M)]; | ||
1077 | else | ||
1078 | l = new List<Object>(); | ||
1079 | |||
1080 | if (l.Contains(mod)) | ||
1081 | return; | ||
1082 | |||
1083 | l.Add(mod); | ||
1084 | |||
1085 | if (mod is IEntityCreator) | ||
1086 | { | ||
1087 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
1088 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
1089 | { | ||
1090 | m_entityCreators[pcode] = entityCreator; | ||
1091 | } | ||
1092 | } | ||
1093 | |||
1094 | ModuleInterfaces[typeof(M)] = l; | ||
1095 | } | ||
1096 | |||
1097 | /// <summary> | ||
1098 | /// For the given interface, retrieve the region module which implements it. | ||
1099 | /// </summary> | ||
1100 | /// <returns>null if there is no registered module implementing that interface</returns> | ||
1101 | public T RequestModuleInterface<T>() | ||
1102 | { | ||
1103 | if (ModuleInterfaces.ContainsKey(typeof(T)) && | ||
1104 | (ModuleInterfaces[typeof(T)].Count > 0)) | ||
1105 | return (T)ModuleInterfaces[typeof(T)][0]; | ||
1106 | else | ||
1107 | return default(T); | ||
1108 | } | ||
1109 | |||
1110 | /// <summary> | ||
1111 | /// For the given interface, retrieve an array of region modules that implement it. | ||
1112 | /// </summary> | ||
1113 | /// <returns>an empty array if there are no registered modules implementing that interface</returns> | ||
1114 | public T[] RequestModuleInterfaces<T>() | ||
1115 | { | ||
1116 | if (ModuleInterfaces.ContainsKey(typeof(T))) | ||
1117 | { | ||
1118 | List<T> ret = new List<T>(); | ||
1119 | |||
1120 | foreach (Object o in ModuleInterfaces[typeof(T)]) | ||
1121 | ret.Add((T)o); | ||
1122 | return ret.ToArray(); | ||
1123 | } | ||
1124 | else | ||
1125 | { | ||
1126 | return new T[] {}; | ||
1127 | } | ||
1128 | } | ||
1129 | |||
1130 | #endregion | ||
1131 | |||
1132 | /// <summary> | ||
1133 | /// Call this from a region module to add a command to the OpenSim console. | ||
1134 | /// </summary> | ||
1135 | /// <param name="mod"></param> | ||
1136 | /// <param name="command"></param> | ||
1137 | /// <param name="shorthelp"></param> | ||
1138 | /// <param name="longhelp"></param> | ||
1139 | /// <param name="callback"></param> | ||
1140 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) | ||
1141 | { | ||
1142 | AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); | ||
1143 | } | ||
1144 | |||
1145 | /// <summary> | ||
1146 | /// Call this from a region module to add a command to the OpenSim console. | ||
1147 | /// </summary> | ||
1148 | /// <param name="mod"> | ||
1149 | /// The use of IRegionModuleBase is a cheap trick to get a different method signature, | ||
1150 | /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. | ||
1151 | /// </param> | ||
1152 | /// <param name="category"> | ||
1153 | /// Category of the command. This is the section under which it will appear when the user asks for help | ||
1154 | /// </param> | ||
1155 | /// <param name="command"></param> | ||
1156 | /// <param name="shorthelp"></param> | ||
1157 | /// <param name="longhelp"></param> | ||
1158 | /// <param name="callback"></param> | ||
1159 | public void AddCommand( | ||
1160 | string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) | ||
1161 | { | ||
1162 | AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); | ||
1163 | } | ||
1164 | |||
1165 | /// <summary> | ||
1166 | /// Call this from a region module to add a command to the OpenSim console. | ||
1167 | /// </summary> | ||
1168 | /// <param name="mod"></param> | ||
1169 | /// <param name="command"></param> | ||
1170 | /// <param name="shorthelp"></param> | ||
1171 | /// <param name="longhelp"></param> | ||
1172 | /// <param name="descriptivehelp"></param> | ||
1173 | /// <param name="callback"></param> | ||
1174 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | ||
1175 | { | ||
1176 | string moduleName = ""; | ||
1177 | |||
1178 | if (module != null) | ||
1179 | moduleName = module.Name; | ||
1180 | |||
1181 | AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); | ||
1182 | } | ||
1183 | |||
1184 | /// <summary> | ||
1185 | /// Call this from a region module to add a command to the OpenSim console. | ||
1186 | /// </summary> | ||
1187 | /// <param name="category"> | ||
1188 | /// Category of the command. This is the section under which it will appear when the user asks for help | ||
1189 | /// </param> | ||
1190 | /// <param name="mod"></param> | ||
1191 | /// <param name="command"></param> | ||
1192 | /// <param name="shorthelp"></param> | ||
1193 | /// <param name="longhelp"></param> | ||
1194 | /// <param name="descriptivehelp"></param> | ||
1195 | /// <param name="callback"></param> | ||
1196 | public void AddCommand( | ||
1197 | string category, IRegionModuleBase module, string command, | ||
1198 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | ||
1199 | { | ||
1200 | if (MainConsole.Instance == null) | ||
1201 | return; | ||
1202 | |||
1203 | bool shared = false; | ||
1204 | |||
1205 | if (module != null) | ||
1206 | shared = module is ISharedRegionModule; | ||
1207 | |||
1208 | MainConsole.Instance.Commands.AddCommand( | ||
1209 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); | ||
1210 | } | ||
1211 | |||
1212 | public virtual ISceneObject DeserializeObject(string representation) | ||
1213 | { | ||
1214 | return null; | ||
1215 | } | ||
1216 | |||
1217 | public virtual bool AllowScriptCrossings | ||
1218 | { | ||
1219 | get { return false; } | ||
1220 | } | ||
1221 | |||
1222 | public virtual void Start() | ||
1223 | { | ||
1224 | } | ||
1225 | |||
1226 | public void Restart() | ||
1227 | { | ||
1228 | // This has to be here to fire the event | ||
1229 | restart handlerPhysicsCrash = OnRestart; | ||
1230 | if (handlerPhysicsCrash != null) | ||
1231 | handlerPhysicsCrash(RegionInfo); | ||
1232 | } | ||
1233 | |||
1234 | public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); | ||
1235 | } | ||
1236 | } | ||
1237 | >>>>>>> avn/ubitvar | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index a2625c4..df7a72a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -85,15 +85,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
85 | if (neighbourService != null) | 85 | if (neighbourService != null) |
86 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); | 86 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); |
87 | else | 87 | else |
88 | m_log.DebugFormat( | 88 | m_log.DebugFormat( "{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name); |
89 | "[SCENE COMMUNICATION SERVICE]: No neighbour service provided for region {0} to inform neigbhours of status", | ||
90 | m_scene.Name); | ||
91 | 89 | ||
92 | if (neighbour != null) | 90 | if (neighbour != null) |
93 | { | 91 | { |
94 | m_log.DebugFormat( | 92 | m_log.DebugFormat( "{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up", |
95 | "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up", | 93 | LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
96 | m_scene.Name, neighbour.RegionName, x / Constants.RegionSize, y / Constants.RegionSize); | ||
97 | 94 | ||
98 | m_scene.EventManager.TriggerOnRegionUp(neighbour); | 95 | m_scene.EventManager.TriggerOnRegionUp(neighbour); |
99 | } | 96 | } |
@@ -112,12 +109,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
112 | List<GridRegion> neighbours | 109 | List<GridRegion> neighbours |
113 | = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); | 110 | = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); |
114 | 111 | ||
115 | m_log.DebugFormat( | 112 | List<GridRegion> onlineNeighbours = new List<GridRegion>(); |
116 | "[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up", | ||
117 | neighbours.Count, m_scene.Name); | ||
118 | 113 | ||
119 | foreach (GridRegion n in neighbours) | 114 | foreach (GridRegion n in neighbours) |
120 | { | 115 | { |
116 | OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags; | ||
117 | |||
118 | // m_log.DebugFormat( | ||
119 | // "{0}: Region flags for {1} as seen by {2} are {3}", | ||
120 | // LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present"); | ||
121 | |||
122 | // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could | ||
123 | // make a separate RegionFlags call but this would involve a network call for each neighbour. | ||
124 | if (regionFlags != null) | ||
125 | { | ||
126 | if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0) | ||
127 | onlineNeighbours.Add(n); | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | onlineNeighbours.Add(n); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | m_log.DebugFormat( | ||
136 | "{0} Informing {1} neighbours that region {2} is up", | ||
137 | LogHeader, onlineNeighbours.Count, m_scene.Name); | ||
138 | |||
139 | foreach (GridRegion n in onlineNeighbours) | ||
140 | { | ||
121 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | 141 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; |
122 | d.BeginInvoke(neighbourService, region, n.RegionHandle, | 142 | d.BeginInvoke(neighbourService, region, n.RegionHandle, |
123 | InformNeighborsThatRegionisUpCompleted, | 143 | InformNeighborsThatRegionisUpCompleted, |
@@ -155,6 +175,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
155 | 175 | ||
156 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) | 176 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) |
157 | { | 177 | { |
178 | // m_log.DebugFormat( | ||
179 | // "[SCENE COMMUNICATION SERVICE]: Sending child agent position updates for {0} in {1}", | ||
180 | // presence.Name, m_scene.Name); | ||
181 | |||
158 | // This assumes that we know what our neighbors are. | 182 | // This assumes that we know what our neighbors are. |
159 | try | 183 | try |
160 | { | 184 | { |
@@ -230,7 +254,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
230 | // We must take a copy here since handle acts like a reference when used in an iterator. | 254 | // We must take a copy here since handle acts like a reference when used in an iterator. |
231 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. | 255 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. |
232 | ulong handleCopy = handle; | 256 | ulong handleCopy = handle; |
233 | Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); }); | 257 | Util.FireAndForget( |
258 | o => SendCloseChildAgent(agentID, handleCopy, auth_code), | ||
259 | null, | ||
260 | "SceneCommunicationService.SendCloseChildAgentConnections"); | ||
234 | } | 261 | } |
235 | } | 262 | } |
236 | 263 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 92ce411..3f6a7f8 100644..100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -77,7 +77,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | protected Scene m_parentScene; | 77 | protected Scene m_parentScene; |
78 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | 78 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
79 | protected int m_numRootAgents = 0; | 79 | protected int m_numRootAgents = 0; |
80 | protected int m_numTotalPrim = 0; | ||
80 | protected int m_numPrim = 0; | 81 | protected int m_numPrim = 0; |
82 | protected int m_numMesh = 0; | ||
81 | protected int m_numChildAgents = 0; | 83 | protected int m_numChildAgents = 0; |
82 | protected int m_physicalPrim = 0; | 84 | protected int m_physicalPrim = 0; |
83 | 85 | ||
@@ -432,7 +434,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
432 | 434 | ||
433 | SceneObjectPart[] parts = sceneObject.Parts; | 435 | SceneObjectPart[] parts = sceneObject.Parts; |
434 | 436 | ||
435 | // Clamp child prim sizes and add child prims to the m_numPrim count | 437 | // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives |
438 | // (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count | ||
436 | if (m_parentScene.m_clampPrimSize) | 439 | if (m_parentScene.m_clampPrimSize) |
437 | { | 440 | { |
438 | foreach (SceneObjectPart part in parts) | 441 | foreach (SceneObjectPart part in parts) |
@@ -446,7 +449,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
446 | part.Shape.Scale = scale; | 449 | part.Shape.Scale = scale; |
447 | } | 450 | } |
448 | } | 451 | } |
449 | m_numPrim += parts.Length; | 452 | m_numTotalPrim += parts.Length; |
453 | |||
454 | // Go through all parts (geometric primitives and meshes) of this Scene Object | ||
455 | foreach (SceneObjectPart part in parts) | ||
456 | { | ||
457 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
458 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
459 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
460 | if (part.GetPrimType() == PrimType.SCULPT) | ||
461 | m_numMesh++; | ||
462 | else | ||
463 | m_numPrim++; | ||
464 | } | ||
450 | 465 | ||
451 | sceneObject.AttachToScene(m_parentScene); | 466 | sceneObject.AttachToScene(m_parentScene); |
452 | 467 | ||
@@ -504,7 +519,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
504 | 519 | ||
505 | if (!resultOfObjectLinked) | 520 | if (!resultOfObjectLinked) |
506 | { | 521 | { |
507 | m_numPrim -= grp.PrimCount; | 522 | // Decrement the total number of primitives (meshes and geometric primitives) |
523 | // that are part of the Scene Object being removed | ||
524 | m_numTotalPrim -= grp.PrimCount; | ||
525 | |||
526 | // Go through all parts (primitives and meshes) of this Scene Object | ||
527 | foreach (SceneObjectPart part in grp.Parts) | ||
528 | { | ||
529 | // Keep track of the total number of meshes or geometric primitives left in the scene; | ||
530 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
531 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
532 | if (part.GetPrimType() == PrimType.SCULPT) | ||
533 | m_numMesh--; | ||
534 | else | ||
535 | m_numPrim--; | ||
536 | } | ||
508 | 537 | ||
509 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 538 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
510 | RemovePhysicalPrim(grp.PrimCount); | 539 | RemovePhysicalPrim(grp.PrimCount); |
@@ -786,9 +815,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
786 | 815 | ||
787 | public int GetTotalObjectsCount() | 816 | public int GetTotalObjectsCount() |
788 | { | 817 | { |
818 | return m_numTotalPrim; | ||
819 | } | ||
820 | |||
821 | public int GetTotalPrimObjectsCount() | ||
822 | { | ||
789 | return m_numPrim; | 823 | return m_numPrim; |
790 | } | 824 | } |
791 | 825 | ||
826 | public int GetTotalMeshObjectsCount() | ||
827 | { | ||
828 | return m_numMesh; | ||
829 | } | ||
830 | |||
792 | public int GetActiveObjectsCount() | 831 | public int GetActiveObjectsCount() |
793 | { | 832 | { |
794 | return m_physicalPrim; | 833 | return m_physicalPrim; |
@@ -871,7 +910,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
871 | List<ScenePresence> presences = GetScenePresences(); | 910 | List<ScenePresence> presences = GetScenePresences(); |
872 | foreach (ScenePresence presence in presences) | 911 | foreach (ScenePresence presence in presences) |
873 | { | 912 | { |
874 | if (presence.Firstname == firstName && presence.Lastname == lastName) | 913 | if (string.Equals(presence.Firstname, firstName, StringComparison.CurrentCultureIgnoreCase) |
914 | && string.Equals(presence.Lastname, lastName, StringComparison.CurrentCultureIgnoreCase)) | ||
875 | return presence; | 915 | return presence; |
876 | } | 916 | } |
877 | return null; | 917 | return null; |
@@ -1491,12 +1531,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1491 | /// <summary> | 1531 | /// <summary> |
1492 | /// Update the position of the given group. | 1532 | /// Update the position of the given group. |
1493 | /// </summary> | 1533 | /// </summary> |
1494 | /// <param name="localID"></param> | 1534 | /// <param name="localId"></param> |
1495 | /// <param name="pos"></param> | 1535 | /// <param name="pos"></param> |
1496 | /// <param name="remoteClient"></param> | 1536 | /// <param name="remoteClient"></param> |
1497 | public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) | 1537 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) |
1498 | { | 1538 | { |
1499 | SceneObjectGroup group = GetGroupByPrim(localID); | 1539 | UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId); |
1540 | } | ||
1541 | |||
1542 | /// <summary> | ||
1543 | /// Update the position of the given group. | ||
1544 | /// </summary> | ||
1545 | /// <param name="localId"></param> | ||
1546 | /// <param name="pos"></param> | ||
1547 | /// <param name="updatingAgentId"></param> | ||
1548 | public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId) | ||
1549 | { | ||
1550 | SceneObjectGroup group = GetGroupByPrim(localId); | ||
1500 | 1551 | ||
1501 | if (group != null) | 1552 | if (group != null) |
1502 | { | 1553 | { |
@@ -1512,7 +1563,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1512 | } | 1563 | } |
1513 | else | 1564 | else |
1514 | { | 1565 | { |
1515 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) | 1566 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) |
1516 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) | 1567 | && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) |
1517 | { | 1568 | { |
1518 | group.UpdateGroupPosition(pos); | 1569 | group.UpdateGroupPosition(pos); |
@@ -1612,8 +1663,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1612 | { | 1663 | { |
1613 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | 1664 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) |
1614 | { | 1665 | { |
1615 | group.GrabMovement(offset, pos, remoteClient); | 1666 | group.GrabMovement(objectID, offset, pos, remoteClient); |
1616 | } | 1667 | } |
1668 | |||
1617 | // This is outside the above permissions condition | 1669 | // This is outside the above permissions condition |
1618 | // so that if the object is locked the client moving the object | 1670 | // so that if the object is locked the client moving the object |
1619 | // get's it's position on the simulator even if it was the same as before | 1671 | // get's it's position on the simulator even if it was the same as before |
@@ -2102,8 +2154,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2102 | if (m_parentScene.Permissions.CanDuplicateObject( | 2154 | if (m_parentScene.Permissions.CanDuplicateObject( |
2103 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | 2155 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) |
2104 | { | 2156 | { |
2157 | <<<<<<< HEAD | ||
2158 | m_log.WarnFormat( | ||
2159 | "[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID); | ||
2160 | ======= | ||
2105 | SceneObjectGroup copy = original.Copy(true); | 2161 | SceneObjectGroup copy = original.Copy(true); |
2106 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 2162 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
2163 | >>>>>>> avn/ubitvar | ||
2107 | 2164 | ||
2108 | if (original.OwnerID != AgentID) | 2165 | if (original.OwnerID != AgentID) |
2109 | { | 2166 | { |
@@ -2140,12 +2197,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
2140 | 2197 | ||
2141 | // PROBABLE END OF FIXME | 2198 | // PROBABLE END OF FIXME |
2142 | 2199 | ||
2200 | <<<<<<< HEAD | ||
2201 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | ||
2202 | Entities.Add(copy); | ||
2203 | |||
2204 | lock (SceneObjectGroupsByFullID) | ||
2205 | SceneObjectGroupsByFullID[copy.UUID] = copy; | ||
2206 | |||
2207 | SceneObjectPart[] children = copy.Parts; | ||
2208 | |||
2209 | lock (SceneObjectGroupsByFullPartID) | ||
2210 | { | ||
2211 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | ||
2212 | foreach (SceneObjectPart part in children) | ||
2213 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | ||
2214 | } | ||
2215 | |||
2216 | lock (SceneObjectGroupsByLocalPartID) | ||
2217 | { | ||
2218 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | ||
2219 | foreach (SceneObjectPart part in children) | ||
2220 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | ||
2221 | } | ||
2222 | // PROBABLE END OF FIXME | ||
2223 | |||
2224 | // Since we copy from a source group that is in selected | ||
2225 | // state, but the copy is shown deselected in the viewer, | ||
2226 | // We need to clear the selection flag here, else that | ||
2227 | // prim never gets persisted at all. The client doesn't | ||
2228 | // think it's selected, so it will never send a deselect... | ||
2229 | copy.IsSelected = false; | ||
2230 | |||
2231 | m_numTotalPrim += copy.Parts.Length; | ||
2232 | |||
2233 | // Go through all parts (primitives and meshes) of this Scene Object | ||
2234 | foreach (SceneObjectPart part in copy.Parts) | ||
2235 | { | ||
2236 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
2237 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
2238 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
2239 | if (part.GetPrimType() == PrimType.SCULPT) | ||
2240 | m_numMesh++; | ||
2241 | else | ||
2242 | m_numPrim++; | ||
2243 | } | ||
2244 | |||
2245 | if (rot != Quaternion.Identity) | ||
2246 | { | ||
2247 | copy.UpdateGroupRotationR(rot); | ||
2248 | } | ||
2249 | ======= | ||
2143 | // Since we copy from a source group that is in selected | 2250 | // Since we copy from a source group that is in selected |
2144 | // state, but the copy is shown deselected in the viewer, | 2251 | // state, but the copy is shown deselected in the viewer, |
2145 | // We need to clear the selection flag here, else that | 2252 | // We need to clear the selection flag here, else that |
2146 | // prim never gets persisted at all. The client doesn't | 2253 | // prim never gets persisted at all. The client doesn't |
2147 | // think it's selected, so it will never send a deselect... | 2254 | // think it's selected, so it will never send a deselect... |
2148 | copy.IsSelected = false; | 2255 | copy.IsSelected = false; |
2256 | >>>>>>> avn/ubitvar | ||
2149 | 2257 | ||
2150 | m_numPrim += copy.Parts.Length; | 2258 | m_numPrim += copy.Parts.Length; |
2151 | 2259 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 8c50a81..79de6c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -266,10 +266,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | for (int i = 0; i < parts.Length; i++) | 266 | for (int i = 0; i < parts.Length; i++) |
267 | { | 267 | { |
268 | SceneObjectPart part = parts[i]; | 268 | SceneObjectPart part = parts[i]; |
269 | <<<<<<< HEAD | ||
270 | // m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask); | ||
271 | ownerMask &= part.OwnerMask; | ||
272 | ======= | ||
269 | if (useBase) | 273 | if (useBase) |
270 | ownerMask &= part.BaseMask; | 274 | ownerMask &= part.BaseMask; |
271 | else | 275 | else |
272 | ownerMask &= part.OwnerMask; | 276 | ownerMask &= part.OwnerMask; |
277 | >>>>>>> avn/ubitvar | ||
273 | perms &= part.Inventory.MaskEffectivePermissions(); | 278 | perms &= part.Inventory.MaskEffectivePermissions(); |
274 | } | 279 | } |
275 | 280 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1bb5854..a703377 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | touch = 8, | 77 | touch = 8, |
78 | touch_end = 536870912, | 78 | touch_end = 536870912, |
79 | touch_start = 2097152, | 79 | touch_start = 2097152, |
80 | transaction_result = 33554432, | ||
80 | object_rez = 4194304 | 81 | object_rez = 4194304 |
81 | } | 82 | } |
82 | 83 | ||
@@ -121,12 +122,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
121 | /// since the group's last persistent backup | 122 | /// since the group's last persistent backup |
122 | /// </summary> | 123 | /// </summary> |
123 | private bool m_hasGroupChanged = false; | 124 | private bool m_hasGroupChanged = false; |
125 | <<<<<<< HEAD | ||
126 | private long timeFirstChanged; | ||
127 | private long timeLastChanged; | ||
128 | ======= | ||
124 | private long timeFirstChanged = 0; | 129 | private long timeFirstChanged = 0; |
125 | private long timeLastChanged = 0; | 130 | private long timeLastChanged = 0; |
126 | private long m_maxPersistTime = 0; | 131 | private long m_maxPersistTime = 0; |
127 | private long m_minPersistTime = 0; | 132 | private long m_minPersistTime = 0; |
128 | // private Random m_rand; | 133 | // private Random m_rand; |
129 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); | 134 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); |
135 | >>>>>>> avn/ubitvar | ||
130 | 136 | ||
131 | /// <summary> | 137 | /// <summary> |
132 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage | 138 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage |
@@ -190,12 +196,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
190 | 196 | ||
191 | get { return m_hasGroupChanged; } | 197 | get { return m_hasGroupChanged; } |
192 | } | 198 | } |
199 | |||
200 | private bool m_groupContainsForeignPrims = false; | ||
193 | 201 | ||
194 | /// <summary> | 202 | /// <summary> |
195 | /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since | 203 | /// Whether the group contains prims that came from a different group. This happens when |
196 | /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation. | 204 | /// linking or delinking groups. The implication is that until the group is persisted, |
205 | /// the prims in the database still use the old SceneGroupID. That's a problem if the group | ||
206 | /// is deleted, because we delete groups by searching for prims by their SceneGroupID. | ||
197 | /// </summary> | 207 | /// </summary> |
208 | <<<<<<< HEAD | ||
209 | public bool GroupContainsForeignPrims | ||
210 | { | ||
211 | private set | ||
212 | { | ||
213 | m_groupContainsForeignPrims = value; | ||
214 | if (m_groupContainsForeignPrims) | ||
215 | HasGroupChanged = true; | ||
216 | } | ||
217 | |||
218 | get { return m_groupContainsForeignPrims; } | ||
219 | } | ||
220 | |||
221 | ======= | ||
198 | public bool HasGroupChangedDueToDelink { get; set; } | 222 | public bool HasGroupChangedDueToDelink { get; set; } |
223 | >>>>>>> avn/ubitvar | ||
199 | 224 | ||
200 | private bool isTimeToPersist() | 225 | private bool isTimeToPersist() |
201 | { | 226 | { |
@@ -325,7 +350,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | get { return RootPart.VolumeDetectActive; } | 350 | get { return RootPart.VolumeDetectActive; } |
326 | } | 351 | } |
327 | 352 | ||
353 | <<<<<<< HEAD | ||
354 | private Vector3 lastPhysGroupPos; | ||
355 | private Quaternion lastPhysGroupRot; | ||
356 | |||
357 | /// <summary> | ||
358 | /// Is this entity set to be saved in persistent storage? | ||
359 | /// </summary> | ||
360 | public bool Backup { get; private set; } | ||
361 | ======= | ||
328 | private bool m_isBackedUp; | 362 | private bool m_isBackedUp; |
363 | >>>>>>> avn/ubitvar | ||
329 | 364 | ||
330 | public bool IsBackedUp | 365 | public bool IsBackedUp |
331 | { | 366 | { |
@@ -507,7 +542,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
507 | /// <returns></returns> | 542 | /// <returns></returns> |
508 | public bool IsAttachmentCheckFull() | 543 | public bool IsAttachmentCheckFull() |
509 | { | 544 | { |
510 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); | 545 | return (IsAttachment || (m_rootPart.Shape.PCode == (byte)PCodeEnum.Primitive && m_rootPart.Shape.State != 0)); |
511 | } | 546 | } |
512 | 547 | ||
513 | private struct avtocrossInfo | 548 | private struct avtocrossInfo |
@@ -535,11 +570,146 @@ namespace OpenSim.Region.Framework.Scenes | |||
535 | && !Scene.LoadingPrims | 570 | && !Scene.LoadingPrims |
536 | ) | 571 | ) |
537 | { | 572 | { |
573 | <<<<<<< HEAD | ||
574 | if ( | ||
575 | !Scene.PositionIsInCurrentRegion(val) | ||
576 | && !IsAttachmentCheckFull() | ||
577 | && (!Scene.LoadingPrims) | ||
578 | ) | ||
579 | { | ||
580 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
581 | string version = String.Empty; | ||
582 | Vector3 newpos = Vector3.Zero; | ||
583 | string failureReason = String.Empty; | ||
584 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
585 | |||
586 | if (m_rootPart.KeyframeMotion != null) | ||
587 | m_rootPart.KeyframeMotion.StartCrossingCheck(); | ||
588 | |||
589 | bool canCross = true; | ||
590 | foreach (ScenePresence av in GetSittingAvatars()) | ||
591 | { | ||
592 | // We need to cross these agents. First, let's find | ||
593 | // out if any of them can't cross for some reason. | ||
594 | // We have to deny the crossing entirely if any | ||
595 | // of them are banned. Alternatively, we could | ||
596 | // unsit banned agents.... | ||
597 | |||
598 | |||
599 | // We set the avatar position as being the object | ||
600 | // position to get the region to send to | ||
601 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null) | ||
602 | { | ||
603 | canCross = false; | ||
604 | break; | ||
605 | } | ||
606 | |||
607 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | ||
608 | } | ||
609 | |||
610 | if (canCross) | ||
611 | { | ||
612 | // We unparent the SP quietly so that it won't | ||
613 | // be made to stand up | ||
614 | |||
615 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); | ||
616 | |||
617 | foreach (ScenePresence av in GetSittingAvatars()) | ||
618 | { | ||
619 | avtocrossInfo avinfo = new avtocrossInfo(); | ||
620 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); | ||
621 | if (parentPart != null) | ||
622 | av.ParentUUID = parentPart.UUID; | ||
623 | |||
624 | avinfo.av = av; | ||
625 | avinfo.ParentID = av.ParentID; | ||
626 | avsToCross.Add(avinfo); | ||
627 | |||
628 | av.PrevSitOffset = av.OffsetPosition; | ||
629 | av.ParentID = 0; | ||
630 | } | ||
631 | |||
632 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
633 | |||
634 | // Normalize | ||
635 | if (val.X >= m_scene.RegionInfo.RegionSizeX) | ||
636 | val.X -= m_scene.RegionInfo.RegionSizeX; | ||
637 | if (val.Y >= m_scene.RegionInfo.RegionSizeY) | ||
638 | val.Y -= m_scene.RegionInfo.RegionSizeY; | ||
639 | if (val.X < 0) | ||
640 | val.X += m_scene.RegionInfo.RegionSizeX; | ||
641 | if (val.Y < 0) | ||
642 | val.Y += m_scene.RegionInfo.RegionSizeY; | ||
643 | |||
644 | // If it's deleted, crossing was successful | ||
645 | if (IsDeleted) | ||
646 | { | ||
647 | foreach (avtocrossInfo avinfo in avsToCross) | ||
648 | { | ||
649 | ScenePresence av = avinfo.av; | ||
650 | if (!av.IsInTransit) // just in case... | ||
651 | { | ||
652 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
653 | |||
654 | av.IsInTransit = true; | ||
655 | |||
656 | // A temporary measure to allow regression tests to work. | ||
657 | // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget | ||
658 | // or similar since BeginInvoke() always uses the system threadpool to launch | ||
659 | // threads rather than any replace threadpool that we might be using. | ||
660 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | ||
661 | { | ||
662 | entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version); | ||
663 | CrossAgentToNewRegionCompleted(av); | ||
664 | } | ||
665 | else | ||
666 | { | ||
667 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
668 | d.BeginInvoke( | ||
669 | av, val, destination, av.Flying, version, | ||
670 | ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); | ||
671 | } | ||
672 | } | ||
673 | else | ||
674 | { | ||
675 | m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val); | ||
676 | } | ||
677 | } | ||
678 | |||
679 | return; | ||
680 | } | ||
681 | else // cross failed, put avas back ?? | ||
682 | { | ||
683 | foreach (avtocrossInfo avinfo in avsToCross) | ||
684 | { | ||
685 | ScenePresence av = avinfo.av; | ||
686 | av.ParentUUID = UUID.Zero; | ||
687 | av.ParentID = avinfo.ParentID; | ||
688 | } | ||
689 | } | ||
690 | } | ||
691 | else | ||
692 | { | ||
693 | if (m_rootPart.KeyframeMotion != null) | ||
694 | m_rootPart.KeyframeMotion.CrossingFailure(); | ||
695 | |||
696 | if (RootPart.PhysActor != null) | ||
697 | { | ||
698 | RootPart.PhysActor.CrossingFailure(); | ||
699 | } | ||
700 | } | ||
701 | |||
702 | Vector3 oldp = AbsolutePosition; | ||
703 | val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f); | ||
704 | val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f); | ||
705 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight); | ||
706 | ======= | ||
538 | if (!inTransit) | 707 | if (!inTransit) |
539 | { | 708 | { |
540 | inTransit = true; | 709 | inTransit = true; |
541 | SOGCrossDelegate d = CrossAsync; | 710 | SOGCrossDelegate d = CrossAsync; |
542 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); | 711 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); |
712 | >>>>>>> avn/ubitvar | ||
543 | } | 713 | } |
544 | return; | 714 | return; |
545 | } | 715 | } |
@@ -780,11 +950,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
780 | } | 950 | } |
781 | } | 951 | } |
782 | 952 | ||
783 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 953 | private void CrossAgentToNewRegionCompleted(ScenePresence agent) |
784 | { | 954 | { |
785 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
786 | ScenePresence agent = icon.EndInvoke(iar); | ||
787 | |||
788 | //// If the cross was successful, this agent is a child agent | 955 | //// If the cross was successful, this agent is a child agent |
789 | if (agent.IsChildAgent) | 956 | if (agent.IsChildAgent) |
790 | { | 957 | { |
@@ -871,7 +1038,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
871 | set { m_rootPart.Text = value; } | 1038 | set { m_rootPart.Text = value; } |
872 | } | 1039 | } |
873 | 1040 | ||
874 | protected virtual bool InSceneBackup | 1041 | /// <summary> |
1042 | /// If set to true then the scene object can be backed up in principle, though this will only actually occur | ||
1043 | /// if Backup is set. If false then the scene object will never be backed up, Backup will always be false. | ||
1044 | /// </summary> | ||
1045 | protected virtual bool CanBeBackedUp | ||
875 | { | 1046 | { |
876 | get { return true; } | 1047 | get { return true; } |
877 | } | 1048 | } |
@@ -1014,6 +1185,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1014 | public UUID FromFolderID { get; set; } | 1185 | public UUID FromFolderID { get; set; } |
1015 | 1186 | ||
1016 | /// <summary> | 1187 | /// <summary> |
1188 | /// If true then grabs are blocked no matter what the individual part BlockGrab setting. | ||
1189 | /// </summary> | ||
1190 | /// <value><c>true</c> if block grab override; otherwise, <c>false</c>.</value> | ||
1191 | public bool BlockGrabOverride { get; set; } | ||
1192 | |||
1193 | /// <summary> | ||
1017 | /// IDs of all avatars sat on this scene object. | 1194 | /// IDs of all avatars sat on this scene object. |
1018 | /// </summary> | 1195 | /// </summary> |
1019 | /// <remarks> | 1196 | /// <remarks> |
@@ -1023,7 +1200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1023 | /// No avatar should appear more than once in this list. | 1200 | /// No avatar should appear more than once in this list. |
1024 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. | 1201 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. |
1025 | /// </remarks> | 1202 | /// </remarks> |
1026 | protected internal List<UUID> m_sittingAvatars = new List<UUID>(); | 1203 | protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>(); |
1027 | 1204 | ||
1028 | #endregion | 1205 | #endregion |
1029 | 1206 | ||
@@ -1089,23 +1266,67 @@ namespace OpenSim.Region.Framework.Scenes | |||
1089 | } | 1266 | } |
1090 | } | 1267 | } |
1091 | 1268 | ||
1269 | public void LoadScriptState(XmlReader reader) | ||
1270 | { | ||
1271 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0}", Name); | ||
1272 | |||
1273 | while (true) | ||
1274 | { | ||
1275 | if (reader.Name == "SavedScriptState" && reader.NodeType == XmlNodeType.Element) | ||
1276 | { | ||
1277 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); | ||
1278 | |||
1279 | if (m_savedScriptState == null) | ||
1280 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
1281 | |||
1282 | string uuid = reader.GetAttribute("UUID"); | ||
1283 | |||
1284 | // Even if there is no UUID attribute for some strange reason, we must always read the inner XML | ||
1285 | // so we don't continually keep checking the same SavedScriptedState element. | ||
1286 | string innerXml = reader.ReadInnerXml(); | ||
1287 | |||
1288 | if (uuid != null) | ||
1289 | { | ||
1290 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); | ||
1291 | |||
1292 | UUID itemid = new UUID(uuid); | ||
1293 | if (itemid != UUID.Zero) | ||
1294 | m_savedScriptState[itemid] = innerXml; | ||
1295 | } | ||
1296 | else | ||
1297 | { | ||
1298 | m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name); | ||
1299 | } | ||
1300 | } | ||
1301 | else | ||
1302 | { | ||
1303 | if (!reader.Read()) | ||
1304 | break; | ||
1305 | } | ||
1306 | } | ||
1307 | } | ||
1308 | |||
1092 | /// <summary> | 1309 | /// <summary> |
1093 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. | 1310 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. |
1094 | /// </summary> | 1311 | /// </summary> |
1095 | public virtual void AttachToBackup() | 1312 | public virtual void AttachToBackup() |
1096 | { | 1313 | { |
1314 | <<<<<<< HEAD | ||
1315 | if (CanBeBackedUp) | ||
1316 | ======= | ||
1097 | if (IsAttachment) return; | 1317 | if (IsAttachment) return; |
1098 | m_scene.SceneGraph.FireAttachToBackup(this); | 1318 | m_scene.SceneGraph.FireAttachToBackup(this); |
1099 | 1319 | ||
1100 | if (InSceneBackup) | 1320 | if (InSceneBackup) |
1321 | >>>>>>> avn/ubitvar | ||
1101 | { | 1322 | { |
1102 | //m_log.DebugFormat( | 1323 | // m_log.DebugFormat( |
1103 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); | 1324 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); |
1104 | 1325 | ||
1105 | if (!m_isBackedUp) | 1326 | if (!Backup) |
1106 | m_scene.EventManager.OnBackup += ProcessBackup; | 1327 | m_scene.EventManager.OnBackup += ProcessBackup; |
1107 | 1328 | ||
1108 | m_isBackedUp = true; | 1329 | Backup = true; |
1109 | } | 1330 | } |
1110 | } | 1331 | } |
1111 | 1332 | ||
@@ -1210,12 +1431,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1210 | /// <returns></returns> | 1431 | /// <returns></returns> |
1211 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 1432 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
1212 | { | 1433 | { |
1434 | <<<<<<< HEAD | ||
1435 | maxX = -256f; | ||
1436 | maxY = -256f; | ||
1437 | maxZ = -256f; | ||
1438 | minX = 10000f; | ||
1439 | minY = 10000f; | ||
1440 | minZ = 10000f; | ||
1441 | ======= | ||
1213 | maxX = float.MinValue; | 1442 | maxX = float.MinValue; |
1214 | maxY = float.MinValue; | 1443 | maxY = float.MinValue; |
1215 | maxZ = float.MinValue; | 1444 | maxZ = float.MinValue; |
1216 | minX = float.MaxValue; | 1445 | minX = float.MaxValue; |
1217 | minY = float.MaxValue; | 1446 | minY = float.MaxValue; |
1218 | minZ = float.MaxValue; | 1447 | minZ = float.MaxValue; |
1448 | >>>>>>> avn/ubitvar | ||
1219 | 1449 | ||
1220 | SceneObjectPart[] parts = m_parts.GetArray(); | 1450 | SceneObjectPart[] parts = m_parts.GetArray(); |
1221 | foreach (SceneObjectPart part in parts) | 1451 | foreach (SceneObjectPart part in parts) |
@@ -1613,6 +1843,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1613 | } | 1843 | } |
1614 | } | 1844 | } |
1615 | 1845 | ||
1846 | <<<<<<< HEAD | ||
1847 | |||
1848 | /// <summary> | ||
1849 | /// | ||
1850 | /// </summary> | ||
1851 | /// <param name="part"></param> | ||
1852 | private void SetPartAsNonRoot(SceneObjectPart part) | ||
1853 | { | ||
1854 | part.ParentID = m_rootPart.LocalId; | ||
1855 | part.ClearUndoState(); | ||
1856 | ======= | ||
1616 | /// <summary> | 1857 | /// <summary> |
1617 | /// Add the avatar to this linkset (avatar is sat). | 1858 | /// Add the avatar to this linkset (avatar is sat). |
1618 | /// </summary> | 1859 | /// </summary> |
@@ -1652,6 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1652 | public List<ScenePresence> GetLinkedAvatars() | 1893 | public List<ScenePresence> GetLinkedAvatars() |
1653 | { | 1894 | { |
1654 | return m_linkedAvatars; | 1895 | return m_linkedAvatars; |
1896 | >>>>>>> avn/ubitvar | ||
1655 | } | 1897 | } |
1656 | 1898 | ||
1657 | /// <summary> | 1899 | /// <summary> |
@@ -1955,7 +2197,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1955 | 2197 | ||
1956 | if (Scene != null) | 2198 | if (Scene != null) |
1957 | { | 2199 | { |
2200 | <<<<<<< HEAD | ||
2201 | if (!sp.IsChildAgent && sp.ParentID == part.LocalId) | ||
2202 | sp.StandUp(); | ||
2203 | |||
2204 | if (!silent) | ||
2205 | ======= | ||
1958 | Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) | 2206 | Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) |
2207 | >>>>>>> avn/ubitvar | ||
1959 | { | 2208 | { |
1960 | if (avatar.ParentID == LocalId) | 2209 | if (avatar.ParentID == LocalId) |
1961 | avatar.StandUp(); | 2210 | avatar.StandUp(); |
@@ -2097,7 +2346,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2097 | /// <param name="datastore"></param> | 2346 | /// <param name="datastore"></param> |
2098 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) | 2347 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) |
2099 | { | 2348 | { |
2100 | if (!m_isBackedUp) | 2349 | if (!Backup) |
2101 | { | 2350 | { |
2102 | // m_log.DebugFormat( | 2351 | // m_log.DebugFormat( |
2103 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); | 2352 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); |
@@ -2187,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2187 | backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; | 2436 | backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; |
2188 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; | 2437 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; |
2189 | HasGroupChanged = false; | 2438 | HasGroupChanged = false; |
2190 | HasGroupChangedDueToDelink = false; | 2439 | GroupContainsForeignPrims = false; |
2191 | 2440 | ||
2192 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | 2441 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); |
2193 | 2442 | ||
@@ -2255,6 +2504,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2255 | /// <returns></returns> | 2504 | /// <returns></returns> |
2256 | public SceneObjectGroup Copy(bool userExposed) | 2505 | public SceneObjectGroup Copy(bool userExposed) |
2257 | { | 2506 | { |
2507 | <<<<<<< HEAD | ||
2508 | // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up | ||
2509 | // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator | ||
2510 | // but not between regions on different simulators). Really, all copying should be done explicitly. | ||
2511 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | ||
2512 | |||
2513 | dupe.Backup = false; | ||
2514 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | ||
2515 | dupe.m_sittingAvatars = new List<ScenePresence>(); | ||
2516 | ======= | ||
2258 | m_dupeInProgress = true; | 2517 | m_dupeInProgress = true; |
2259 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 2518 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
2260 | dupe.m_isBackedUp = false; | 2519 | dupe.m_isBackedUp = false; |
@@ -2266,6 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2266 | dupe.m_linkedAvatars = new List<ScenePresence>(); | 2525 | dupe.m_linkedAvatars = new List<ScenePresence>(); |
2267 | dupe.m_sittingAvatars = new List<UUID>(); | 2526 | dupe.m_sittingAvatars = new List<UUID>(); |
2268 | 2527 | ||
2528 | >>>>>>> avn/ubitvar | ||
2269 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 2529 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
2270 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 2530 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
2271 | 2531 | ||
@@ -2440,16 +2700,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2440 | return RootPart.Torque; | 2700 | return RootPart.Torque; |
2441 | } | 2701 | } |
2442 | 2702 | ||
2703 | <<<<<<< HEAD | ||
2704 | public void MoveToTarget(Vector3 target, float tau) | ||
2705 | ======= | ||
2443 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2706 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object |
2444 | public void moveToTarget(Vector3 target, float tau) | 2707 | public void moveToTarget(Vector3 target, float tau) |
2708 | >>>>>>> avn/ubitvar | ||
2445 | { | 2709 | { |
2446 | if (IsAttachment) | 2710 | if (IsAttachment) |
2447 | { | 2711 | { |
2448 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 2712 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2713 | |||
2449 | if (avatar != null) | 2714 | if (avatar != null) |
2450 | { | ||
2451 | avatar.MoveToTarget(target, false, false); | 2715 | avatar.MoveToTarget(target, false, false); |
2452 | } | ||
2453 | } | 2716 | } |
2454 | else | 2717 | else |
2455 | { | 2718 | { |
@@ -2464,11 +2727,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2464 | } | 2727 | } |
2465 | } | 2728 | } |
2466 | 2729 | ||
2467 | public void stopMoveToTarget() | 2730 | public void StopMoveToTarget() |
2468 | { | 2731 | { |
2469 | if (IsAttachment) | 2732 | if (IsAttachment) |
2470 | { | 2733 | { |
2471 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 2734 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2735 | <<<<<<< HEAD | ||
2736 | |||
2737 | if (avatar != null) | ||
2738 | avatar.ResetMoveToTarget(); | ||
2739 | } | ||
2740 | else | ||
2741 | { | ||
2742 | PhysicsActor pa = RootPart.PhysActor; | ||
2743 | |||
2744 | if (pa != null && pa.PIDActive) | ||
2745 | { | ||
2746 | pa.PIDActive = false; | ||
2747 | |||
2748 | ScheduleGroupForTerseUpdate(); | ||
2749 | ======= | ||
2472 | if (avatar != null) | 2750 | if (avatar != null) |
2473 | { | 2751 | { |
2474 | avatar.ResetMoveToTarget(); | 2752 | avatar.ResetMoveToTarget(); |
@@ -2508,6 +2786,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2508 | rootpart.PhysActor.APIDDamping = damping; | 2786 | rootpart.PhysActor.APIDDamping = damping; |
2509 | rootpart.PhysActor.APIDActive = true; | 2787 | rootpart.PhysActor.APIDActive = true; |
2510 | } | 2788 | } |
2789 | >>>>>>> avn/ubitvar | ||
2511 | } | 2790 | } |
2512 | } | 2791 | } |
2513 | } | 2792 | } |
@@ -3055,7 +3334,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3055 | // objectGroup.m_rootPart = null; | 3334 | // objectGroup.m_rootPart = null; |
3056 | 3335 | ||
3057 | // If linking prims with different permissions, fix them | 3336 | // If linking prims with different permissions, fix them |
3058 | AdjustChildPrimPermissions(); | 3337 | AdjustChildPrimPermissions(false); |
3338 | |||
3339 | GroupContainsForeignPrims = true; | ||
3059 | 3340 | ||
3060 | AttachToBackup(); | 3341 | AttachToBackup(); |
3061 | 3342 | ||
@@ -3203,6 +3484,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3203 | 3484 | ||
3204 | linkPart.Rezzed = RootPart.Rezzed; | 3485 | linkPart.Rezzed = RootPart.Rezzed; |
3205 | 3486 | ||
3487 | <<<<<<< HEAD | ||
3488 | // We must persist the delinked group to the database immediately, for safety. The problem | ||
3489 | // is that although in memory the new group has a new SceneGroupID, in the database it | ||
3490 | // still has the parent group's SceneGroupID (until the next backup). This means that if the | ||
3491 | // parent group is deleted then the delinked group will also be deleted from the database. | ||
3492 | // This problem will disappear if the region remains alive long enough for another backup, | ||
3493 | // since at that time the delinked group's new SceneGroupID will be written to the database. | ||
3494 | // But if the region crashes before that then the prims will be permanently gone, and this must | ||
3495 | // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case | ||
3496 | // because the delinked group doesn't know when the source group is deleted.) | ||
3497 | m_scene.ForceSceneObjectBackup(objectGroup); | ||
3498 | ======= | ||
3206 | // When we delete a group, we currently have to force persist to the database if the object id has changed | 3499 | // When we delete a group, we currently have to force persist to the database if the object id has changed |
3207 | // (since delete works by deleting all rows which have a given object id) | 3500 | // (since delete works by deleting all rows which have a given object id) |
3208 | 3501 | ||
@@ -3214,6 +3507,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3214 | m_rootPart.PhysActor.Building = false; | 3507 | m_rootPart.PhysActor.Building = false; |
3215 | 3508 | ||
3216 | objectGroup.HasGroupChangedDueToDelink = true; | 3509 | objectGroup.HasGroupChangedDueToDelink = true; |
3510 | >>>>>>> avn/ubitvar | ||
3217 | 3511 | ||
3218 | if (sendEvents) | 3512 | if (sendEvents) |
3219 | linkPart.TriggerScriptChangedEvent(Changed.LINK); | 3513 | linkPart.TriggerScriptChangedEvent(Changed.LINK); |
@@ -3227,12 +3521,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3227 | /// <param name="objectGroup"></param> | 3521 | /// <param name="objectGroup"></param> |
3228 | public virtual void DetachFromBackup() | 3522 | public virtual void DetachFromBackup() |
3229 | { | 3523 | { |
3524 | <<<<<<< HEAD | ||
3525 | if (Backup && Scene != null) | ||
3526 | ======= | ||
3230 | if (m_scene != null) | 3527 | if (m_scene != null) |
3231 | m_scene.SceneGraph.FireDetachFromBackup(this); | 3528 | m_scene.SceneGraph.FireDetachFromBackup(this); |
3232 | if (m_isBackedUp && Scene != null) | 3529 | if (m_isBackedUp && Scene != null) |
3530 | >>>>>>> avn/ubitvar | ||
3233 | m_scene.EventManager.OnBackup -= ProcessBackup; | 3531 | m_scene.EventManager.OnBackup -= ProcessBackup; |
3234 | 3532 | ||
3235 | m_isBackedUp = false; | 3533 | Backup = false; |
3236 | } | 3534 | } |
3237 | 3535 | ||
3238 | // This links an SOP from a previous linkset into my linkset. | 3536 | // This links an SOP from a previous linkset into my linkset. |
@@ -3295,20 +3593,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3295 | /// If object is physical, apply force to move it around | 3593 | /// If object is physical, apply force to move it around |
3296 | /// If object is not physical, just put it at the resulting location | 3594 | /// If object is not physical, just put it at the resulting location |
3297 | /// </summary> | 3595 | /// </summary> |
3596 | /// <param name="partID">Part ID to check for grab</param> | ||
3298 | /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> | 3597 | /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> |
3299 | /// <param name="pos">New position. We do the math here to turn it into a force</param> | 3598 | /// <param name="pos">New position. We do the math here to turn it into a force</param> |
3300 | /// <param name="remoteClient"></param> | 3599 | /// <param name="remoteClient"></param> |
3301 | public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient) | 3600 | public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient) |
3302 | { | 3601 | { |
3303 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 3602 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
3304 | { | 3603 | { |
3604 | SceneObjectPart part = GetPart(partID); | ||
3605 | |||
3606 | if (part == null) | ||
3607 | return; | ||
3608 | |||
3305 | PhysicsActor pa = m_rootPart.PhysActor; | 3609 | PhysicsActor pa = m_rootPart.PhysActor; |
3306 | 3610 | ||
3307 | if (pa != null) | 3611 | if (pa != null) |
3308 | { | 3612 | { |
3309 | if (pa.IsPhysical) | 3613 | if (pa.IsPhysical) |
3310 | { | 3614 | { |
3311 | if (!m_rootPart.BlockGrab) | 3615 | if (!BlockGrabOverride && !part.BlockGrab) |
3312 | { | 3616 | { |
3313 | /* Vector3 llmoveforce = pos - AbsolutePosition; | 3617 | /* Vector3 llmoveforce = pos - AbsolutePosition; |
3314 | Vector3 grabforce = llmoveforce; | 3618 | Vector3 grabforce = llmoveforce; |
@@ -3323,20 +3627,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3323 | } | 3627 | } |
3324 | else | 3628 | else |
3325 | { | 3629 | { |
3326 | //NonPhysicalGrabMovement(pos); | 3630 | NonPhysicalGrabMovement(pos); |
3327 | } | 3631 | } |
3328 | } | 3632 | } |
3329 | else | 3633 | else |
3330 | { | 3634 | { |
3331 | //NonPhysicalGrabMovement(pos); | 3635 | NonPhysicalGrabMovement(pos); |
3332 | } | 3636 | } |
3333 | } | 3637 | } |
3334 | } | 3638 | } |
3335 | 3639 | ||
3640 | /// <summary> | ||
3641 | /// Apply possition for grabbing non-physical linksets (Ctrl+Drag) | ||
3642 | /// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch | ||
3643 | /// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to | ||
3644 | /// block grab on prims with touch events. | ||
3645 | /// </summary> | ||
3646 | /// <param name="pos">New Position</param> | ||
3336 | public void NonPhysicalGrabMovement(Vector3 pos) | 3647 | public void NonPhysicalGrabMovement(Vector3 pos) |
3337 | { | 3648 | { |
3338 | AbsolutePosition = pos; | 3649 | if(!IsAttachment && ScriptCount() == 0) |
3339 | m_rootPart.SendTerseUpdateToAllClients(); | 3650 | UpdateGroupPosition(pos); |
3340 | } | 3651 | } |
3341 | 3652 | ||
3342 | /// <summary> | 3653 | /// <summary> |
@@ -3432,17 +3743,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3432 | } | 3743 | } |
3433 | else | 3744 | else |
3434 | { | 3745 | { |
3435 | //NonPhysicalSpinMovement(pos); | 3746 | NonPhysicalSpinMovement(newOrientation); |
3436 | } | 3747 | } |
3437 | } | 3748 | } |
3438 | else | 3749 | else |
3439 | { | 3750 | { |
3440 | //NonPhysicalSpinMovement(pos); | 3751 | NonPhysicalSpinMovement(newOrientation); |
3441 | } | 3752 | } |
3442 | } | 3753 | } |
3443 | } | 3754 | } |
3444 | 3755 | ||
3445 | /// <summary> | 3756 | /// <summary> |
3757 | /// Apply rotation for spinning non-physical linksets (Ctrl+Shift+Drag) | ||
3758 | /// As with dragging, scripted objects must be blocked from spinning | ||
3759 | /// </summary> | ||
3760 | /// <param name="newOrientation">New Rotation</param> | ||
3761 | private void NonPhysicalSpinMovement(Quaternion newOrientation) | ||
3762 | { | ||
3763 | if(!IsAttachment && ScriptCount() == 0) | ||
3764 | UpdateGroupRotationR(newOrientation); | ||
3765 | } | ||
3766 | |||
3767 | /// <summary> | ||
3446 | /// Set the name of a prim | 3768 | /// Set the name of a prim |
3447 | /// </summary> | 3769 | /// </summary> |
3448 | /// <param name="name"></param> | 3770 | /// <param name="name"></param> |
@@ -3517,12 +3839,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3517 | 3839 | ||
3518 | SceneObjectPart selectionPart = GetPart(localID); | 3840 | SceneObjectPart selectionPart = GetPart(localID); |
3519 | 3841 | ||
3520 | if (SetTemporary && Scene != null) | 3842 | if (Scene != null) |
3521 | { | 3843 | { |
3522 | DetachFromBackup(); | 3844 | if (SetTemporary) |
3523 | // Remove from database and parcel prim count | 3845 | { |
3524 | // | 3846 | DetachFromBackup(); |
3525 | m_scene.DeleteFromStorage(UUID); | 3847 | // Remove from database and parcel prim count |
3848 | // | ||
3849 | m_scene.DeleteFromStorage(UUID); | ||
3850 | } | ||
3851 | else if (!Backup) | ||
3852 | { | ||
3853 | // Previously been temporary now switching back so make it | ||
3854 | // available for persisting again | ||
3855 | AttachToBackup(); | ||
3856 | } | ||
3857 | |||
3526 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 3858 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
3527 | } | 3859 | } |
3528 | 3860 | ||
@@ -3611,7 +3943,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | } | 3943 | } |
3612 | } | 3944 | } |
3613 | 3945 | ||
3614 | public void AdjustChildPrimPermissions() | 3946 | public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) |
3615 | { | 3947 | { |
3616 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits | 3948 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits |
3617 | uint foldedPerms = RootPart.OwnerMask & 3; | 3949 | uint foldedPerms = RootPart.OwnerMask & 3; |
@@ -3621,11 +3953,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3621 | newOwnerMask &= part.BaseMask; | 3953 | newOwnerMask &= part.BaseMask; |
3622 | if (part != RootPart) | 3954 | if (part != RootPart) |
3623 | part.ClonePermissions(RootPart); | 3955 | part.ClonePermissions(RootPart); |
3956 | if (forceTaskInventoryPermissive) | ||
3957 | part.Inventory.ApplyGodPermissions(part.BaseMask); | ||
3624 | }); | 3958 | }); |
3625 | 3959 | ||
3626 | uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); | 3960 | uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); |
3627 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); | 3961 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); |
3628 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); | 3962 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); |
3963 | |||
3964 | // m_log.DebugFormat( | ||
3965 | // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", | ||
3966 | // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); | ||
3967 | |||
3629 | RootPart.ScheduleFullUpdate(); | 3968 | RootPart.ScheduleFullUpdate(); |
3630 | } | 3969 | } |
3631 | 3970 | ||
@@ -3634,6 +3973,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | { | 3973 | { |
3635 | RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); | 3974 | RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); |
3636 | 3975 | ||
3976 | <<<<<<< HEAD | ||
3977 | AdjustChildPrimPermissions(Scene.Permissions.IsGod(AgentID)); | ||
3978 | ======= | ||
3637 | bool god = Scene.Permissions.IsGod(AgentID); | 3979 | bool god = Scene.Permissions.IsGod(AgentID); |
3638 | 3980 | ||
3639 | if (field == 1 && god) | 3981 | if (field == 1 && god) |
@@ -3645,6 +3987,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3645 | } | 3987 | } |
3646 | 3988 | ||
3647 | AdjustChildPrimPermissions(); | 3989 | AdjustChildPrimPermissions(); |
3990 | >>>>>>> avn/ubitvar | ||
3648 | 3991 | ||
3649 | if (field == 1 && god) // Base mask was set. Update all child part inventories | 3992 | if (field == 1 && god) // Base mask was set. Update all child part inventories |
3650 | { | 3993 | { |
@@ -4694,10 +5037,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4694 | /// down after it move one place down the list. | 5037 | /// down after it move one place down the list. |
4695 | /// </remarks> | 5038 | /// </remarks> |
4696 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> | 5039 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> |
4697 | public List<UUID> GetSittingAvatars() | 5040 | public List<ScenePresence> GetSittingAvatars() |
4698 | { | 5041 | { |
4699 | lock (m_sittingAvatars) | 5042 | lock (m_sittingAvatars) |
4700 | return new List<UUID>(m_sittingAvatars); | 5043 | return new List<ScenePresence>(m_sittingAvatars); |
4701 | } | 5044 | } |
4702 | 5045 | ||
4703 | /// <summary> | 5046 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8979659..1cfa8ed 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -198,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | 198 | ||
199 | public bool RETURN_AT_EDGE; | 199 | public bool RETURN_AT_EDGE; |
200 | 200 | ||
201 | public bool BlockGrab; | 201 | public bool BlockGrab { get; set; } |
202 | 202 | ||
203 | public bool StatusSandbox; | 203 | public bool StatusSandbox; |
204 | 204 | ||
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
286 | 286 | ||
287 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 287 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
288 | 288 | ||
289 | protected int m_APIDIterations = 0; | 289 | protected bool m_APIDActive = false; |
290 | protected Quaternion m_APIDTarget = Quaternion.Identity; | 290 | protected Quaternion m_APIDTarget = Quaternion.Identity; |
291 | protected float m_APIDDamp = 0; | 291 | protected float m_APIDDamp = 0; |
292 | protected float m_APIDStrength = 0; | 292 | protected float m_APIDStrength = 0; |
@@ -680,6 +680,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | protected bool APIDActive | ||
684 | { | ||
685 | get { return m_APIDActive; } | ||
686 | set { m_APIDActive = value; } | ||
687 | } | ||
688 | |||
683 | protected Quaternion APIDTarget | 689 | protected Quaternion APIDTarget |
684 | { | 690 | { |
685 | get { return m_APIDTarget; } | 691 | get { return m_APIDTarget; } |
@@ -1001,14 +1007,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1001 | 1007 | ||
1002 | set | 1008 | set |
1003 | { | 1009 | { |
1004 | m_velocity = value; | 1010 | if (Util.IsNanOrInfinity(value)) |
1011 | m_velocity = Vector3.Zero; | ||
1012 | else | ||
1013 | m_velocity = value; | ||
1005 | 1014 | ||
1006 | PhysicsActor actor = PhysActor; | 1015 | PhysicsActor actor = PhysActor; |
1007 | if (actor != null) | 1016 | if (actor != null) |
1008 | { | 1017 | { |
1009 | if (actor.IsPhysical) | 1018 | if (actor.IsPhysical) |
1010 | { | 1019 | { |
1011 | actor.Velocity = value; | 1020 | actor.Velocity = m_velocity; |
1012 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 1021 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
1013 | } | 1022 | } |
1014 | } | 1023 | } |
@@ -1037,18 +1046,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
1037 | } | 1046 | } |
1038 | set | 1047 | set |
1039 | { | 1048 | { |
1049 | <<<<<<< HEAD | ||
1050 | if (Util.IsNanOrInfinity(value)) | ||
1051 | m_angularVelocity = Vector3.Zero; | ||
1052 | else | ||
1053 | m_angularVelocity = value; | ||
1054 | |||
1055 | PhysicsActor actor = PhysActor; | ||
1056 | if ((actor != null) && actor.IsPhysical) | ||
1057 | actor.RotationalVelocity = m_angularVelocity; | ||
1058 | ======= | ||
1040 | m_angularVelocity = value; | 1059 | m_angularVelocity = value; |
1041 | PhysicsActor actor = PhysActor; | 1060 | PhysicsActor actor = PhysActor; |
1042 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) | 1061 | if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) |
1043 | { | 1062 | { |
1044 | actor.RotationalVelocity = m_angularVelocity; | 1063 | actor.RotationalVelocity = m_angularVelocity; |
1045 | } | 1064 | } |
1065 | >>>>>>> avn/ubitvar | ||
1046 | } | 1066 | } |
1047 | } | 1067 | } |
1048 | 1068 | ||
1049 | /// <summary></summary> | 1069 | /// <summary></summary> |
1050 | public Vector3 Acceleration | 1070 | public Vector3 Acceleration |
1051 | { | 1071 | { |
1072 | <<<<<<< HEAD | ||
1073 | get { return m_acceleration; } | ||
1074 | set | ||
1075 | { | ||
1076 | if (Util.IsNanOrInfinity(value)) | ||
1077 | m_acceleration = Vector3.Zero; | ||
1078 | else | ||
1079 | m_acceleration = value; | ||
1080 | } | ||
1081 | ======= | ||
1052 | get | 1082 | get |
1053 | { | 1083 | { |
1054 | PhysicsActor actor = PhysActor; | 1084 | PhysicsActor actor = PhysActor; |
@@ -1060,6 +1090,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1060 | } | 1090 | } |
1061 | 1091 | ||
1062 | set { m_acceleration = value; } | 1092 | set { m_acceleration = value; } |
1093 | >>>>>>> avn/ubitvar | ||
1063 | } | 1094 | } |
1064 | 1095 | ||
1065 | public string Description { get; set; } | 1096 | public string Description { get; set; } |
@@ -1400,7 +1431,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1400 | /// <value> | 1431 | /// <value> |
1401 | /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. | 1432 | /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. |
1402 | /// </value> | 1433 | /// </value> |
1403 | private HashSet<UUID> m_sittingAvatars; | 1434 | private HashSet<ScenePresence> m_sittingAvatars; |
1404 | 1435 | ||
1405 | public virtual UUID RegionID | 1436 | public virtual UUID RegionID |
1406 | { | 1437 | { |
@@ -1901,11 +1932,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
1901 | 1932 | ||
1902 | public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) | 1933 | public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) |
1903 | { | 1934 | { |
1935 | <<<<<<< HEAD | ||
1936 | byte[] data; | ||
1937 | |||
1938 | if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF) | ||
1939 | { | ||
1940 | data = Utils.EmptyBytes; | ||
1941 | } | ||
1942 | else | ||
1943 | { | ||
1944 | data = new byte[16]; | ||
1945 | int pos = 0; | ||
1946 | |||
1947 | ======= | ||
1904 | if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON | 1948 | if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON |
1905 | { | 1949 | { |
1906 | byte[] data = new byte[16]; | 1950 | byte[] data = new byte[16]; |
1907 | int pos = 0; | 1951 | int pos = 0; |
1908 | 1952 | ||
1953 | >>>>>>> avn/ubitvar | ||
1909 | // The flags don't like conversion from uint to byte, so we have to do | 1954 | // The flags don't like conversion from uint to byte, so we have to do |
1910 | // it the crappy way. See the above function :( | 1955 | // it the crappy way. See the above function :( |
1911 | 1956 | ||
@@ -1917,6 +1962,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1917 | Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); | 1962 | Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); |
1918 | Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); | 1963 | Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); |
1919 | Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); | 1964 | Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); |
1965 | <<<<<<< HEAD | ||
1966 | } | ||
1967 | ======= | ||
1968 | >>>>>>> avn/ubitvar | ||
1920 | 1969 | ||
1921 | m_TextureAnimation = data; | 1970 | m_TextureAnimation = data; |
1922 | } | 1971 | } |
@@ -2134,7 +2183,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2134 | /// <returns></returns> | 2183 | /// <returns></returns> |
2135 | public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) | 2184 | public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) |
2136 | { | 2185 | { |
2186 | // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up | ||
2187 | // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator | ||
2188 | // but not between regions on different simulators). Really, all copying should be done explicitly. | ||
2137 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); | 2189 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); |
2190 | |||
2138 | dupe.m_shape = m_shape.Copy(); | 2191 | dupe.m_shape = m_shape.Copy(); |
2139 | dupe.m_regionHandle = m_regionHandle; | 2192 | dupe.m_regionHandle = m_regionHandle; |
2140 | if (userExposed) | 2193 | if (userExposed) |
@@ -2187,6 +2240,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2187 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 2240 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
2188 | dupe.Shape.ExtraParams = extraP; | 2241 | dupe.Shape.ExtraParams = extraP; |
2189 | 2242 | ||
2243 | dupe.m_sittingAvatars = new HashSet<ScenePresence>(); | ||
2244 | |||
2190 | // safeguard actual copy is done in sog.copy | 2245 | // safeguard actual copy is done in sog.copy |
2191 | dupe.KeyframeMotion = null; | 2246 | dupe.KeyframeMotion = null; |
2192 | dupe.PayPrice = (int[])PayPrice.Clone(); | 2247 | dupe.PayPrice = (int[])PayPrice.Clone(); |
@@ -2436,7 +2491,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2436 | /// </summary> | 2491 | /// </summary> |
2437 | /// <param name="xmlReader"></param> | 2492 | /// <param name="xmlReader"></param> |
2438 | /// <returns></returns> | 2493 | /// <returns></returns> |
2439 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) | 2494 | public static SceneObjectPart FromXml(XmlReader xmlReader) |
2440 | { | 2495 | { |
2441 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); | 2496 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); |
2442 | 2497 | ||
@@ -2471,22 +2526,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2471 | ParentGroup.RootPart.RETURN_AT_EDGE = p; | 2526 | ParentGroup.RootPart.RETURN_AT_EDGE = p; |
2472 | } | 2527 | } |
2473 | 2528 | ||
2474 | public bool GetBlockGrab() | ||
2475 | { | ||
2476 | if (ParentGroup.IsDeleted) | ||
2477 | return false; | ||
2478 | |||
2479 | return ParentGroup.RootPart.BlockGrab; | ||
2480 | } | ||
2481 | |||
2482 | public void SetBlockGrab(bool p) | ||
2483 | { | ||
2484 | if (ParentGroup.IsDeleted) | ||
2485 | return; | ||
2486 | |||
2487 | ParentGroup.RootPart.BlockGrab = p; | ||
2488 | } | ||
2489 | |||
2490 | public void SetStatusSandbox(bool p) | 2529 | public void SetStatusSandbox(bool p) |
2491 | { | 2530 | { |
2492 | if (ParentGroup.IsDeleted) | 2531 | if (ParentGroup.IsDeleted) |
@@ -2649,7 +2688,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2649 | { | 2688 | { |
2650 | if (tau > 0) | 2689 | if (tau > 0) |
2651 | { | 2690 | { |
2652 | ParentGroup.moveToTarget(target, tau); | 2691 | ParentGroup.MoveToTarget(target, tau); |
2653 | } | 2692 | } |
2654 | else | 2693 | else |
2655 | { | 2694 | { |
@@ -2790,7 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2790 | CollidingMessage = CreateColliderArgs(this, colliders); | 2829 | CollidingMessage = CreateColliderArgs(this, colliders); |
2791 | 2830 | ||
2792 | if (CollidingMessage.Colliders.Count > 0) | 2831 | if (CollidingMessage.Colliders.Count > 0) |
2793 | notify(LocalId, CollidingMessage); | 2832 | DoNotify(notify, LocalId, CollidingMessage); |
2794 | 2833 | ||
2795 | if (PassCollisions) | 2834 | if (PassCollisions) |
2796 | sendToRoot = true; | 2835 | sendToRoot = true; |
@@ -2804,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2804 | { | 2843 | { |
2805 | CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); | 2844 | CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); |
2806 | if (CollidingMessage.Colliders.Count > 0) | 2845 | if (CollidingMessage.Colliders.Count > 0) |
2807 | notify(ParentGroup.RootPart.LocalId, CollidingMessage); | 2846 | DoNotify(notify, ParentGroup.RootPart.LocalId, CollidingMessage); |
2808 | } | 2847 | } |
2809 | } | 2848 | } |
2810 | } | 2849 | } |
@@ -2819,6 +2858,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2819 | colliding.Add(CreateDetObjectForGround()); | 2858 | colliding.Add(CreateDetObjectForGround()); |
2820 | LandCollidingMessage.Colliders = colliding; | 2859 | LandCollidingMessage.Colliders = colliding; |
2821 | 2860 | ||
2861 | <<<<<<< HEAD | ||
2862 | DoNotify(notify, LocalId, LandCollidingMessage); | ||
2863 | } | ||
2864 | } | ||
2865 | |||
2866 | private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs) | ||
2867 | { | ||
2868 | if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions) | ||
2869 | { | ||
2870 | // For those learning C#, FireAndForget takes a function, an object to pass | ||
2871 | // to that function and an ID string. The "oo => {}" construct is a lambda expression | ||
2872 | // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object | ||
2873 | // that is an object array and initializes it with three items (the parameters | ||
2874 | // being passed). The parameters passed are the function to call ('notify') and | ||
2875 | // its two arguements. Finally, once in the function (called later by the FireAndForget | ||
2876 | // thread scheduler), the passed object is cast to an object array and then each | ||
2877 | // of its items (aoo[0] to aoo[2]) are individually cast to what they are and | ||
2878 | // then used in a call of the passed ScriptCollidingNotification function. | ||
2879 | Util.FireAndForget(oo => | ||
2880 | { | ||
2881 | Object[] aoo = (Object[])oo; | ||
2882 | ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]); | ||
2883 | |||
2884 | }, new Object[] { notify, id, collargs }, "SOP.Collision"); | ||
2885 | } | ||
2886 | else | ||
2887 | { | ||
2888 | notify(id, collargs); | ||
2889 | ======= | ||
2822 | if (Inventory.ContainsScripts()) | 2890 | if (Inventory.ContainsScripts()) |
2823 | { | 2891 | { |
2824 | if (!PassCollisions) | 2892 | if (!PassCollisions) |
@@ -2830,6 +2898,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2830 | if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) | 2898 | if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) |
2831 | { | 2899 | { |
2832 | notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); | 2900 | notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); |
2901 | >>>>>>> avn/ubitvar | ||
2833 | } | 2902 | } |
2834 | } | 2903 | } |
2835 | 2904 | ||
@@ -2977,10 +3046,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2977 | 3046 | ||
2978 | if (pa != null) | 3047 | if (pa != null) |
2979 | { | 3048 | { |
3049 | <<<<<<< HEAD | ||
3050 | Vector3 newpos = pa.Position; | ||
3051 | ======= | ||
2980 | Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); | 3052 | Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); |
2981 | 3053 | ||
3054 | >>>>>>> avn/ubitvar | ||
2982 | if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) | 3055 | if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) |
2983 | { | 3056 | { |
3057 | // Setting position outside current region will start region crossing | ||
2984 | ParentGroup.AbsolutePosition = newpos; | 3058 | ParentGroup.AbsolutePosition = newpos; |
2985 | return; | 3059 | return; |
2986 | } | 3060 | } |
@@ -3109,7 +3183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3109 | return; | 3183 | return; |
3110 | } | 3184 | } |
3111 | 3185 | ||
3112 | m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); | 3186 | APIDActive = true; |
3113 | } | 3187 | } |
3114 | 3188 | ||
3115 | // Necessary to get the lookat deltas applied | 3189 | // Necessary to get the lookat deltas applied |
@@ -3123,7 +3197,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3123 | 3197 | ||
3124 | public void StopLookAt() | 3198 | public void StopLookAt() |
3125 | { | 3199 | { |
3126 | APIDTarget = Quaternion.Identity; | 3200 | APIDActive = false; |
3127 | } | 3201 | } |
3128 | 3202 | ||
3129 | 3203 | ||
@@ -3922,10 +3996,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3922 | 3996 | ||
3923 | public void StopMoveToTarget() | 3997 | public void StopMoveToTarget() |
3924 | { | 3998 | { |
3999 | <<<<<<< HEAD | ||
4000 | ParentGroup.StopMoveToTarget(); | ||
4001 | ======= | ||
3925 | ParentGroup.stopMoveToTarget(); | 4002 | ParentGroup.stopMoveToTarget(); |
3926 | 4003 | ||
3927 | // ParentGroup.ScheduleGroupForTerseUpdate(); | 4004 | // ParentGroup.ScheduleGroupForTerseUpdate(); |
3928 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4005 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4006 | >>>>>>> avn/ubitvar | ||
3929 | } | 4007 | } |
3930 | 4008 | ||
3931 | public void StoreUndoState(ObjectChangeType change) | 4009 | public void StoreUndoState(ObjectChangeType change) |
@@ -4773,6 +4851,12 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4773 | } | 4851 | } |
4774 | else // it already has a physical representation | 4852 | else // it already has a physical representation |
4775 | { | 4853 | { |
4854 | <<<<<<< HEAD | ||
4855 | pa.SetMaterial(Material); | ||
4856 | pa.Position = GetWorldPosition(); | ||
4857 | pa.Orientation = GetWorldRotation(); | ||
4858 | DoPhysicsPropertyUpdate(UsePhysics, true); | ||
4859 | ======= | ||
4776 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. | 4860 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. |
4777 | /* moved into DoPhysicsPropertyUpdate | 4861 | /* moved into DoPhysicsPropertyUpdate |
4778 | if(VolumeDetectActive) | 4862 | if(VolumeDetectActive) |
@@ -4780,6 +4864,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4780 | else | 4864 | else |
4781 | pa.SetVolumeDetect(0); | 4865 | pa.SetVolumeDetect(0); |
4782 | */ | 4866 | */ |
4867 | >>>>>>> avn/ubitvar | ||
4783 | 4868 | ||
4784 | if (pa.Building != building) | 4869 | if (pa.Building != building) |
4785 | pa.Building = building; | 4870 | pa.Building = building; |
@@ -5434,7 +5519,10 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5434 | if (OwnerID != item.Owner) | 5519 | if (OwnerID != item.Owner) |
5435 | { | 5520 | { |
5436 | //LogPermissions("Before ApplyNextOwnerPermissions"); | 5521 | //LogPermissions("Before ApplyNextOwnerPermissions"); |
5437 | ApplyNextOwnerPermissions(); | 5522 | |
5523 | if (scene.Permissions.PropagatePermissions()) | ||
5524 | ApplyNextOwnerPermissions(); | ||
5525 | |||
5438 | //LogPermissions("After ApplyNextOwnerPermissions"); | 5526 | //LogPermissions("After ApplyNextOwnerPermissions"); |
5439 | 5527 | ||
5440 | LastOwnerID = OwnerID; | 5528 | LastOwnerID = OwnerID; |
@@ -5468,20 +5556,34 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5468 | { | 5556 | { |
5469 | try | 5557 | try |
5470 | { | 5558 | { |
5471 | if (APIDTarget != Quaternion.Identity) | 5559 | if (APIDActive) |
5472 | { | 5560 | { |
5473 | if (m_APIDIterations <= 1) | 5561 | PhysicsActor pa = ParentGroup.RootPart.PhysActor; |
5562 | if (pa == null || !pa.IsPhysical || APIDStrength < 0.04) | ||
5474 | { | 5563 | { |
5475 | UpdateRotation(APIDTarget); | 5564 | StopLookAt(); |
5476 | APIDTarget = Quaternion.Identity; | ||
5477 | return; | 5565 | return; |
5478 | } | 5566 | } |
5479 | 5567 | ||
5480 | Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); | 5568 | Quaternion currRot = GetWorldRotation(); |
5481 | rot.Normalize(); | 5569 | currRot.Normalize(); |
5482 | UpdateRotation(rot); | 5570 | |
5571 | // difference between current orientation and desired orientation | ||
5572 | Quaternion dR = currRot / APIDTarget; | ||
5573 | |||
5574 | // find axis and angle of rotation to rotate to desired orientation | ||
5575 | Vector3 axis = Vector3.UnitX; | ||
5576 | float angle; | ||
5577 | dR.GetAxisAngle(out axis, out angle); | ||
5578 | axis = axis * currRot; | ||
5579 | |||
5580 | // clamp strength to avoid overshoot | ||
5581 | float strength = 1.0f / APIDStrength; | ||
5582 | if (strength > 1.0) strength = 1.0f; | ||
5483 | 5583 | ||
5484 | m_APIDIterations--; | 5584 | // set angular velocity to rotate to desired orientation |
5585 | // with velocity proportional to strength and angle | ||
5586 | AngularVelocity = axis * angle * strength * (float)Math.PI; | ||
5485 | 5587 | ||
5486 | // This ensures that we'll check this object on the next iteration | 5588 | // This ensures that we'll check this object on the next iteration |
5487 | ParentGroup.QueueForUpdateCheck(); | 5589 | ParentGroup.QueueForUpdateCheck(); |
@@ -5519,19 +5621,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5519 | /// true if the avatar was not already recorded, false otherwise. | 5621 | /// true if the avatar was not already recorded, false otherwise. |
5520 | /// </returns> | 5622 | /// </returns> |
5521 | /// <param name='avatarId'></param> | 5623 | /// <param name='avatarId'></param> |
5522 | protected internal bool AddSittingAvatar(UUID avatarId) | 5624 | protected internal bool AddSittingAvatar(ScenePresence sp) |
5523 | { | 5625 | { |
5524 | lock (ParentGroup.m_sittingAvatars) | 5626 | lock (ParentGroup.m_sittingAvatars) |
5525 | { | 5627 | { |
5526 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5628 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) |
5527 | SitTargetAvatar = avatarId; | 5629 | SitTargetAvatar = sp.UUID; |
5528 | 5630 | ||
5529 | if (m_sittingAvatars == null) | 5631 | if (m_sittingAvatars == null) |
5530 | m_sittingAvatars = new HashSet<UUID>(); | 5632 | m_sittingAvatars = new HashSet<ScenePresence>(); |
5531 | 5633 | ||
5532 | if (m_sittingAvatars.Add(avatarId)) | 5634 | if (m_sittingAvatars.Add(sp)) |
5533 | { | 5635 | { |
5534 | ParentGroup.m_sittingAvatars.Add(avatarId); | 5636 | ParentGroup.m_sittingAvatars.Add(sp); |
5535 | 5637 | ||
5536 | return true; | 5638 | return true; |
5537 | } | 5639 | } |
@@ -5548,22 +5650,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5548 | /// true if the avatar was present and removed, false if it was not present. | 5650 | /// true if the avatar was present and removed, false if it was not present. |
5549 | /// </returns> | 5651 | /// </returns> |
5550 | /// <param name='avatarId'></param> | 5652 | /// <param name='avatarId'></param> |
5551 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5653 | protected internal bool RemoveSittingAvatar(ScenePresence sp) |
5552 | { | 5654 | { |
5553 | lock (ParentGroup.m_sittingAvatars) | 5655 | lock (ParentGroup.m_sittingAvatars) |
5554 | { | 5656 | { |
5555 | if (SitTargetAvatar == avatarId) | 5657 | if (SitTargetAvatar == sp.UUID) |
5556 | SitTargetAvatar = UUID.Zero; | 5658 | SitTargetAvatar = UUID.Zero; |
5557 | 5659 | ||
5558 | if (m_sittingAvatars == null) | 5660 | if (m_sittingAvatars == null) |
5559 | return false; | 5661 | return false; |
5560 | 5662 | ||
5561 | if (m_sittingAvatars.Remove(avatarId)) | 5663 | if (m_sittingAvatars.Remove(sp)) |
5562 | { | 5664 | { |
5563 | if (m_sittingAvatars.Count == 0) | 5665 | if (m_sittingAvatars.Count == 0) |
5564 | m_sittingAvatars = null; | 5666 | m_sittingAvatars = null; |
5565 | 5667 | ||
5566 | ParentGroup.m_sittingAvatars.Remove(avatarId); | 5668 | ParentGroup.m_sittingAvatars.Remove(sp); |
5567 | 5669 | ||
5568 | return true; | 5670 | return true; |
5569 | } | 5671 | } |
@@ -5577,14 +5679,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5577 | /// </summary> | 5679 | /// </summary> |
5578 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> | 5680 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> |
5579 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5681 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5580 | public HashSet<UUID> GetSittingAvatars() | 5682 | public HashSet<ScenePresence> GetSittingAvatars() |
5581 | { | 5683 | { |
5582 | lock (ParentGroup.m_sittingAvatars) | 5684 | lock (ParentGroup.m_sittingAvatars) |
5583 | { | 5685 | { |
5584 | if (m_sittingAvatars == null) | 5686 | if (m_sittingAvatars == null) |
5585 | return null; | 5687 | return null; |
5586 | else | 5688 | else |
5587 | return new HashSet<UUID>(m_sittingAvatars); | 5689 | return new HashSet<ScenePresence>(m_sittingAvatars); |
5588 | } | 5690 | } |
5589 | } | 5691 | } |
5590 | 5692 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b9f3f94..7af0b20 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -424,6 +424,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
424 | 424 | ||
425 | private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID) | 425 | private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID) |
426 | { | 426 | { |
427 | // m_log.DebugFormat( | ||
428 | // "[PRIM INVENTORY]: Restoring scripted state for item {0}, oldID {1}, loadedID {2}", | ||
429 | // newID, oldID, loadedID); | ||
430 | |||
427 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 431 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
428 | if (engines.Length == 0) // No engine at all | 432 | if (engines.Length == 0) // No engine at all |
429 | return oldID; | 433 | return oldID; |
@@ -436,7 +440,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
436 | XmlDocument doc = new XmlDocument(); | 440 | XmlDocument doc = new XmlDocument(); |
437 | 441 | ||
438 | doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); | 442 | doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); |
439 | 443 | ||
440 | ////////// CRUFT WARNING /////////////////////////////////// | 444 | ////////// CRUFT WARNING /////////////////////////////////// |
441 | // | 445 | // |
442 | // Old objects will have <ScriptState><State> ... | 446 | // Old objects will have <ScriptState><State> ... |
@@ -466,6 +470,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
466 | // This created document has only the minimun data | 470 | // This created document has only the minimun data |
467 | // necessary for XEngine to parse it successfully | 471 | // necessary for XEngine to parse it successfully |
468 | 472 | ||
473 | // m_log.DebugFormat("[PRIM INVENTORY]: Adding legacy state {0} in {1}", stateID, newID); | ||
474 | |||
469 | m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml; | 475 | m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml; |
470 | } | 476 | } |
471 | 477 | ||
@@ -886,8 +892,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
886 | offsetHeight = 0; | 892 | offsetHeight = 0; |
887 | return false; | 893 | return false; |
888 | } | 894 | } |
895 | <<<<<<< HEAD | ||
896 | |||
897 | Vector3 bbox; | ||
898 | float offsetHeight; | ||
899 | |||
900 | m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); | ||
901 | ======= | ||
889 | 902 | ||
890 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); | 903 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
904 | >>>>>>> avn/ubitvar | ||
891 | 905 | ||
892 | for (int i = 0; i < objlist.Count; i++) | 906 | for (int i = 0; i < objlist.Count; i++) |
893 | { | 907 | { |
@@ -1054,7 +1068,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1054 | m_items.LockItemsForRead(false); | 1068 | m_items.LockItemsForRead(false); |
1055 | if (type == 10) // Script | 1069 | if (type == 10) // Script |
1056 | { | 1070 | { |
1071 | <<<<<<< HEAD | ||
1072 | // route it through here, to handle script cleanup tasks | ||
1073 | RemoveScriptInstance(itemID, false); | ||
1074 | ======= | ||
1057 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 1075 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
1076 | >>>>>>> avn/ubitvar | ||
1058 | } | 1077 | } |
1059 | m_items.LockItemsForWrite(true); | 1078 | m_items.LockItemsForWrite(true); |
1060 | m_items.Remove(itemID); | 1079 | m_items.Remove(itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6390d26..4bccb7d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -37,6 +37,7 @@ using log4net; | |||
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Client; | 39 | using OpenSim.Framework.Client; |
40 | using OpenSim.Framework.Monitoring; | ||
40 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes.Animation; | 42 | using OpenSim.Region.Framework.Scenes.Animation; |
42 | using OpenSim.Region.Framework.Scenes.Types; | 43 | using OpenSim.Region.Framework.Scenes.Types; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | public class ScenePresence : EntityBase, IScenePresence | 77 | public class ScenePresence : EntityBase, IScenePresence |
77 | { | 78 | { |
78 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 79 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
80 | private static readonly String LogHeader = "[SCENE PRESENCE]"; | ||
79 | 81 | ||
80 | // ~ScenePresence() | 82 | // ~ScenePresence() |
81 | // { | 83 | // { |
@@ -297,7 +299,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
297 | // private int m_lastColCount = -1; //KF: Look for Collision chnages | 299 | // private int m_lastColCount = -1; //KF: Look for Collision chnages |
298 | // private int m_updateCount = 0; //KF: Update Anims for a while | 300 | // private int m_updateCount = 0; //KF: Update Anims for a while |
299 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for | 301 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for |
300 | private List<uint> m_lastColliders = new List<uint>(); | ||
301 | 302 | ||
302 | private TeleportFlags m_teleportFlags; | 303 | private TeleportFlags m_teleportFlags; |
303 | public TeleportFlags TeleportFlags | 304 | public TeleportFlags TeleportFlags |
@@ -360,9 +361,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | //private int m_moveToPositionStateStatus; | 361 | //private int m_moveToPositionStateStatus; |
361 | //***************************************************** | 362 | //***************************************************** |
362 | 363 | ||
363 | private bool m_collisionEventFlag = false; | ||
364 | private object m_collisionEventLock = new Object(); | ||
365 | |||
366 | private int m_movementAnimationUpdateCounter = 0; | 364 | private int m_movementAnimationUpdateCounter = 0; |
367 | 365 | ||
368 | public Vector3 PrevSitOffset { get; set; } | 366 | public Vector3 PrevSitOffset { get; set; } |
@@ -379,6 +377,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
379 | } | 377 | } |
380 | } | 378 | } |
381 | 379 | ||
380 | public bool SentInitialDataToClient { get; private set; } | ||
381 | |||
382 | /// <summary> | 382 | /// <summary> |
383 | /// Copy of the script states while the agent is in transit. This state may | 383 | /// Copy of the script states while the agent is in transit. This state may |
384 | /// need to be placed back in case of transfer fail. | 384 | /// need to be placed back in case of transfer fail. |
@@ -438,6 +438,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
438 | private object m_originRegionIDAccessLock = new object(); | 438 | private object m_originRegionIDAccessLock = new object(); |
439 | 439 | ||
440 | /// <summary> | 440 | /// <summary> |
441 | /// Triggered on entity transfer after to allow CompleteMovement() to proceed after we have received an | ||
442 | /// UpdateAgent from the originating region.ddkjjkj | ||
443 | /// </summary> | ||
444 | private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false); | ||
445 | |||
446 | /// <summary> | ||
441 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent | 447 | /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent |
442 | /// teleport is reusing the connection. | 448 | /// teleport is reusing the connection. |
443 | /// </summary> | 449 | /// </summary> |
@@ -464,6 +470,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
464 | public uint MovementFlag { get; private set; } | 470 | public uint MovementFlag { get; private set; } |
465 | 471 | ||
466 | /// <summary> | 472 | /// <summary> |
473 | /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer. | ||
474 | /// </summary> | ||
475 | private const uint ForceUpdateMovementFlagValue = uint.MaxValue; | ||
476 | |||
477 | /// <summary> | ||
467 | /// Is the agent stop control flag currently active? | 478 | /// Is the agent stop control flag currently active? |
468 | /// </summary> | 479 | /// </summary> |
469 | public bool AgentControlStopActive { get; private set; } | 480 | public bool AgentControlStopActive { get; private set; } |
@@ -545,7 +556,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
545 | public string Firstname { get; private set; } | 556 | public string Firstname { get; private set; } |
546 | public string Lastname { get; private set; } | 557 | public string Lastname { get; private set; } |
547 | 558 | ||
548 | public string Grouptitle { get; set; } | 559 | public string Grouptitle |
560 | { | ||
561 | get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; } | ||
562 | set { m_groupTitle = value; } | ||
563 | } | ||
564 | private string m_groupTitle; | ||
565 | |||
566 | /// <summary> | ||
567 | /// When this is 'true', return a dummy group title instead of the real group title. This is | ||
568 | /// used as part of a hack to force viewers to update the displayed avatar name. | ||
569 | /// </summary> | ||
570 | public bool UseFakeGroupTitle { get; set; } | ||
571 | |||
549 | 572 | ||
550 | // Agent's Draw distance. | 573 | // Agent's Draw distance. |
551 | public float DrawDistance { get; set; } | 574 | public float DrawDistance { get; set; } |
@@ -630,6 +653,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
630 | // in the sim unless the avatar is on a sit target. While | 653 | // in the sim unless the avatar is on a sit target. While |
631 | // on a sit target, m_pos will contain the desired offset | 654 | // on a sit target, m_pos will contain the desired offset |
632 | // without the parent rotation applied. | 655 | // without the parent rotation applied. |
656 | <<<<<<< HEAD | ||
657 | SceneObjectPart sitPart = ParentPart; | ||
658 | |||
659 | if (sitPart != null) | ||
660 | return sitPart.ParentGroup.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); | ||
661 | ======= | ||
633 | if (ParentPart != null) | 662 | if (ParentPart != null) |
634 | { | 663 | { |
635 | SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart; | 664 | SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart; |
@@ -638,6 +667,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
638 | if (rootPart != null) | 667 | if (rootPart != null) |
639 | return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation()); | 668 | return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation()); |
640 | } | 669 | } |
670 | >>>>>>> avn/ubitvar | ||
641 | } | 671 | } |
642 | 672 | ||
643 | return m_pos; | 673 | return m_pos; |
@@ -691,8 +721,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
691 | } | 721 | } |
692 | 722 | ||
693 | /// <summary> | 723 | /// <summary> |
694 | /// Current velocity of the avatar. | 724 | /// Velocity of the avatar with respect to its local reference frame. |
695 | /// </summary> | 725 | /// </summary> |
726 | /// <remarks> | ||
727 | /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity() | ||
728 | /// </remarks> | ||
696 | public override Vector3 Velocity | 729 | public override Vector3 Velocity |
697 | { | 730 | { |
698 | get | 731 | get |
@@ -705,11 +738,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", | 738 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", |
706 | // m_velocity, Name, Scene.RegionInfo.RegionName); | 739 | // m_velocity, Name, Scene.RegionInfo.RegionName); |
707 | } | 740 | } |
741 | // else if (ParentPart != null) | ||
742 | // { | ||
743 | // return ParentPart.ParentGroup.Velocity; | ||
744 | // } | ||
708 | 745 | ||
709 | return m_velocity; | 746 | return m_velocity; |
710 | } | 747 | } |
748 | |||
711 | set | 749 | set |
712 | { | 750 | { |
751 | // Util.PrintCallStack(); | ||
752 | // m_log.DebugFormat( | ||
753 | // "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}", | ||
754 | // Scene.RegionInfo.RegionName, Name, value); | ||
755 | |||
713 | if (PhysicsActor != null) | 756 | if (PhysicsActor != null) |
714 | { | 757 | { |
715 | try | 758 | try |
@@ -722,11 +765,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
722 | } | 765 | } |
723 | } | 766 | } |
724 | 767 | ||
725 | m_velocity = value; | 768 | m_velocity = value; |
726 | |||
727 | // m_log.DebugFormat( | ||
728 | // "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}", | ||
729 | // Scene.RegionInfo.RegionName, Name, m_velocity); | ||
730 | } | 769 | } |
731 | } | 770 | } |
732 | 771 | ||
@@ -810,25 +849,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
810 | } | 849 | } |
811 | 850 | ||
812 | /// <summary> | 851 | /// <summary> |
813 | /// Gets the world rotation of this presence. | 852 | /// Get rotation relative to the world. |
814 | /// </summary> | 853 | /// </summary> |
815 | /// <remarks> | ||
816 | /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. | ||
817 | /// </remarks> | ||
818 | /// <returns></returns> | 854 | /// <returns></returns> |
819 | public Quaternion GetWorldRotation() | 855 | public Quaternion GetWorldRotation() |
820 | { | 856 | { |
821 | if (IsSatOnObject) | 857 | SceneObjectPart sitPart = ParentPart; |
822 | { | ||
823 | SceneObjectPart sitPart = ParentPart; | ||
824 | 858 | ||
825 | if (sitPart != null) | 859 | if (sitPart != null) |
826 | return sitPart.GetWorldRotation() * Rotation; | 860 | return sitPart.GetWorldRotation() * Rotation; |
827 | } | ||
828 | 861 | ||
829 | return Rotation; | 862 | return Rotation; |
830 | } | 863 | } |
831 | 864 | ||
865 | /// <summary> | ||
866 | /// Get velocity relative to the world. | ||
867 | /// </summary> | ||
868 | public Vector3 GetWorldVelocity() | ||
869 | { | ||
870 | SceneObjectPart sitPart = ParentPart; | ||
871 | |||
872 | if (sitPart != null) | ||
873 | return sitPart.ParentGroup.Velocity; | ||
874 | |||
875 | return Velocity; | ||
876 | } | ||
877 | |||
832 | public void AdjustKnownSeeds() | 878 | public void AdjustKnownSeeds() |
833 | { | 879 | { |
834 | Dictionary<ulong, string> seeds; | 880 | Dictionary<ulong, string> seeds; |
@@ -844,8 +890,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
844 | { | 890 | { |
845 | uint x, y; | 891 | uint x, y; |
846 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 892 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
893 | <<<<<<< HEAD | ||
894 | |||
895 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | ||
896 | ======= | ||
847 | no information to check this | 897 | no information to check this |
848 | // if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,)) | 898 | // if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,)) |
899 | >>>>>>> avn/ubitvar | ||
849 | { | 900 | { |
850 | old.Add(handle); | 901 | old.Add(handle); |
851 | } | 902 | } |
@@ -873,7 +924,7 @@ no information to check this | |||
873 | } | 924 | } |
874 | 925 | ||
875 | private bool m_mouseLook; | 926 | private bool m_mouseLook; |
876 | private bool m_leftButtonDown; | 927 | // private bool m_leftButtonDown; |
877 | 928 | ||
878 | private bool m_inTransit; | 929 | private bool m_inTransit; |
879 | 930 | ||
@@ -938,9 +989,14 @@ no information to check this | |||
938 | 989 | ||
939 | public string Viewer | 990 | public string Viewer |
940 | { | 991 | { |
941 | get { return m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode).Viewer; } | 992 | get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); } |
942 | } | 993 | } |
943 | 994 | ||
995 | /// <summary> | ||
996 | /// Count of how many terse updates we have sent out. It doesn't matter if this overflows. | ||
997 | /// </summary> | ||
998 | private int m_terseUpdateCount; | ||
999 | |||
944 | #endregion | 1000 | #endregion |
945 | 1001 | ||
946 | #region Constructor(s) | 1002 | #region Constructor(s) |
@@ -956,7 +1012,8 @@ no information to check this | |||
956 | Animator = new ScenePresenceAnimator(this); | 1012 | Animator = new ScenePresenceAnimator(this); |
957 | Overrides = new MovementAnimationOverrides(); | 1013 | Overrides = new MovementAnimationOverrides(); |
958 | PresenceType = type; | 1014 | PresenceType = type; |
959 | DrawDistance = world.DefaultDrawDistance; | 1015 | // DrawDistance = world.DefaultDrawDistance; |
1016 | DrawDistance = Constants.RegionSize; | ||
960 | RegionHandle = world.RegionInfo.RegionHandle; | 1017 | RegionHandle = world.RegionInfo.RegionHandle; |
961 | ControllingClient = client; | 1018 | ControllingClient = client; |
962 | Firstname = ControllingClient.FirstName; | 1019 | Firstname = ControllingClient.FirstName; |
@@ -1046,6 +1103,21 @@ no information to check this | |||
1046 | 1103 | ||
1047 | private void SetDirectionVectors() | 1104 | private void SetDirectionVectors() |
1048 | { | 1105 | { |
1106 | <<<<<<< HEAD | ||
1107 | Dir_Vectors[0] = Vector3.UnitX; //FORWARD | ||
1108 | Dir_Vectors[1] = -Vector3.UnitX; //BACK | ||
1109 | Dir_Vectors[2] = Vector3.UnitY; //LEFT | ||
1110 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT | ||
1111 | Dir_Vectors[4] = Vector3.UnitZ; //UP | ||
1112 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | ||
1113 | Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE | ||
1114 | Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE | ||
1115 | Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE | ||
1116 | Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE | ||
1117 | Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | ||
1118 | } | ||
1119 | |||
1120 | ======= | ||
1049 | Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD | 1121 | Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD |
1050 | Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK | 1122 | Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK |
1051 | Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT | 1123 | Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT |
@@ -1079,6 +1151,7 @@ no information to check this | |||
1079 | return vector; | 1151 | return vector; |
1080 | } | 1152 | } |
1081 | */ | 1153 | */ |
1154 | >>>>>>> avn/ubitvar | ||
1082 | #endregion | 1155 | #endregion |
1083 | 1156 | ||
1084 | #region Status Methods | 1157 | #region Status Methods |
@@ -1130,9 +1203,14 @@ no information to check this | |||
1130 | } | 1203 | } |
1131 | else | 1204 | else |
1132 | { | 1205 | { |
1206 | <<<<<<< HEAD | ||
1207 | part.AddSittingAvatar(this); | ||
1208 | // ParentPosition = part.GetWorldPosition(); | ||
1209 | ======= | ||
1133 | part.ParentGroup.AddAvatar(UUID); | 1210 | part.ParentGroup.AddAvatar(UUID); |
1134 | if (part.SitTargetPosition != Vector3.Zero) | 1211 | if (part.SitTargetPosition != Vector3.Zero) |
1135 | part.SitTargetAvatar = UUID; | 1212 | part.SitTargetAvatar = UUID; |
1213 | >>>>>>> avn/ubitvar | ||
1136 | ParentID = part.LocalId; | 1214 | ParentID = part.LocalId; |
1137 | ParentPart = part; | 1215 | ParentPart = part; |
1138 | m_pos = PrevSitOffset; | 1216 | m_pos = PrevSitOffset; |
@@ -1159,16 +1237,84 @@ no information to check this | |||
1159 | if (gm != null) | 1237 | if (gm != null) |
1160 | Grouptitle = gm.GetGroupTitle(m_uuid); | 1238 | Grouptitle = gm.GetGroupTitle(m_uuid); |
1161 | 1239 | ||
1240 | <<<<<<< HEAD | ||
1241 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode); | ||
1242 | uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags; | ||
1243 | if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0) | ||
1244 | { | ||
1245 | // The avatar is arriving from another grid. This means that we may have changed the | ||
1246 | // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com"). | ||
1247 | // Unfortunately, due to a viewer bug, viewers don't always show the new name. | ||
1248 | // But we have a trick that can force them to update the name anyway. | ||
1249 | ForceViewersUpdateName(); | ||
1250 | } | ||
1251 | ======= | ||
1162 | m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1252 | m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1253 | >>>>>>> avn/ubitvar | ||
1163 | 1254 | ||
1164 | RegionHandle = m_scene.RegionInfo.RegionHandle; | 1255 | RegionHandle = m_scene.RegionInfo.RegionHandle; |
1165 | 1256 | ||
1166 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 1257 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
1167 | m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1258 | m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1168 | 1259 | ||
1260 | <<<<<<< HEAD | ||
1261 | UUID groupUUID = ControllingClient.ActiveGroupId; | ||
1262 | string groupName = string.Empty; | ||
1263 | ulong groupPowers = 0; | ||
1264 | |||
1265 | // ---------------------------------- | ||
1266 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status | ||
1267 | try | ||
1268 | { | ||
1269 | if (groupUUID != UUID.Zero && gm != null) | ||
1270 | { | ||
1271 | GroupRecord record = gm.GetGroupRecord(groupUUID); | ||
1272 | if (record != null) | ||
1273 | groupName = record.GroupName; | ||
1274 | |||
1275 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); | ||
1276 | |||
1277 | if (groupMembershipData != null) | ||
1278 | groupPowers = groupMembershipData.GroupPowers; | ||
1279 | } | ||
1280 | |||
1281 | ControllingClient.SendAgentDataUpdate( | ||
1282 | m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle); | ||
1283 | } | ||
1284 | catch (Exception e) | ||
1285 | { | ||
1286 | m_log.Error("[AGENTUPDATE]: Error ", e); | ||
1287 | } | ||
1288 | // ------------------------------------ | ||
1169 | 1289 | ||
1170 | if (ParentID == 0) | 1290 | if (ParentID == 0) |
1171 | { | 1291 | { |
1292 | // Moved this from SendInitialData to ensure that Appearance is initialized | ||
1293 | // before the inventory is processed in MakeRootAgent. This fixes a race condition | ||
1294 | // related to the handling of attachments | ||
1295 | //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); | ||
1296 | |||
1297 | /* RA 20140111: Commented out these TestBorderCross's. | ||
1298 | * Not sure why this code is here. It is not checking all the borders | ||
1299 | * and 'in region' sanity checking is done in CheckAndAdjustLandingPoint and below. | ||
1300 | if (m_scene.TestBorderCross(pos, Cardinals.E)) | ||
1301 | { | ||
1302 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); | ||
1303 | pos.X = crossedBorder.BorderLine.Z - 1; | ||
1304 | } | ||
1305 | |||
1306 | if (m_scene.TestBorderCross(pos, Cardinals.N)) | ||
1307 | { | ||
1308 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); | ||
1309 | pos.Y = crossedBorder.BorderLine.Z - 1; | ||
1310 | } | ||
1311 | */ | ||
1312 | |||
1313 | ======= | ||
1314 | |||
1315 | if (ParentID == 0) | ||
1316 | { | ||
1317 | >>>>>>> avn/ubitvar | ||
1172 | CheckAndAdjustLandingPoint(ref pos); | 1318 | CheckAndAdjustLandingPoint(ref pos); |
1173 | 1319 | ||
1174 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) | 1320 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) |
@@ -1198,19 +1344,36 @@ no information to check this | |||
1198 | } | 1344 | } |
1199 | AbsolutePosition = pos; | 1345 | AbsolutePosition = pos; |
1200 | 1346 | ||
1347 | // m_log.DebugFormat( | ||
1348 | // "Set pos {0}, vel {1} in {1} to {2} from input position of {3} on MakeRootAgent", | ||
1349 | // Name, Scene.Name, AbsolutePosition, pos); | ||
1350 | // | ||
1201 | if (m_teleportFlags == TeleportFlags.Default) | 1351 | if (m_teleportFlags == TeleportFlags.Default) |
1202 | { | 1352 | { |
1203 | Vector3 vel = Velocity; | ||
1204 | AddToPhysicalScene(isFlying); | 1353 | AddToPhysicalScene(isFlying); |
1205 | if (PhysicsActor != null) | 1354 | // |
1206 | PhysicsActor.SetMomentum(vel); | 1355 | // Console.WriteLine( |
1356 | // "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent", | ||
1357 | // Name, Scene.Name, PhysicsActor.Velocity, vel); | ||
1358 | // } | ||
1207 | } | 1359 | } |
1208 | else | 1360 | else |
1209 | { | 1361 | { |
1210 | AddToPhysicalScene(isFlying); | 1362 | AddToPhysicalScene(isFlying); |
1363 | <<<<<<< HEAD | ||
1364 | } | ||
1365 | |||
1366 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a | ||
1367 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it | ||
1368 | // since it requires a physics actor to be present. If it is left any later, then physics appears to reset | ||
1369 | // the value to a negative position which does not trigger the border cross. | ||
1370 | // This may not be the best location for this. | ||
1371 | CheckForBorderCrossing(); | ||
1372 | ======= | ||
1211 | // reset camera to avatar pos | 1373 | // reset camera to avatar pos |
1212 | CameraPosition = pos; | 1374 | CameraPosition = pos; |
1213 | } | 1375 | } |
1376 | >>>>>>> avn/ubitvar | ||
1214 | 1377 | ||
1215 | if (ForceFly) | 1378 | if (ForceFly) |
1216 | { | 1379 | { |
@@ -1220,6 +1383,40 @@ no information to check this | |||
1220 | { | 1383 | { |
1221 | Flying = false; | 1384 | Flying = false; |
1222 | } | 1385 | } |
1386 | <<<<<<< HEAD | ||
1387 | } | ||
1388 | |||
1389 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | ||
1390 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | ||
1391 | // elsewhere anyway | ||
1392 | // Animator.SendAnimPack(); | ||
1393 | |||
1394 | m_scene.SwapRootAgentCount(false); | ||
1395 | |||
1396 | if (Scene.AttachmentsModule != null) | ||
1397 | { | ||
1398 | // The initial login scene presence is already root when it gets here | ||
1399 | // and it has already rezzed the attachments and started their scripts. | ||
1400 | // We do the following only for non-login agents, because their scripts | ||
1401 | // haven't started yet. | ||
1402 | if (PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags)) | ||
1403 | { | ||
1404 | WorkManager.RunJob( | ||
1405 | "RezAttachments", | ||
1406 | o => Scene.AttachmentsModule.RezAttachments(this), | ||
1407 | null, | ||
1408 | string.Format("Rez attachments for {0} in {1}", Name, Scene.Name)); | ||
1409 | } | ||
1410 | else | ||
1411 | { | ||
1412 | WorkManager.RunJob( | ||
1413 | "StartAttachmentScripts", | ||
1414 | o => RestartAttachmentScripts(), | ||
1415 | null, | ||
1416 | string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name), | ||
1417 | true); | ||
1418 | } | ||
1419 | ======= | ||
1223 | 1420 | ||
1224 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a | 1421 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a |
1225 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it | 1422 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it |
@@ -1230,17 +1427,28 @@ no information to check this | |||
1230 | 1427 | ||
1231 | // its not | 1428 | // its not |
1232 | // CheckForBorderCrossing(); | 1429 | // CheckForBorderCrossing(); |
1430 | >>>>>>> avn/ubitvar | ||
1233 | } | 1431 | } |
1234 | 1432 | ||
1235 | m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1433 | m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1236 | m_scene.SwapRootAgentCount(false); | 1434 | m_scene.SwapRootAgentCount(false); |
1237 | 1435 | ||
1436 | <<<<<<< HEAD | ||
1437 | SendAvatarDataToAllClients(); | ||
1438 | |||
1439 | // send the animations of the other presences to me | ||
1440 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) | ||
1441 | { | ||
1442 | if (presence != this) | ||
1443 | presence.Animator.SendAnimPackToClient(ControllingClient); | ||
1444 | }); | ||
1445 | ======= | ||
1446 | >>>>>>> avn/ubitvar | ||
1238 | 1447 | ||
1239 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | 1448 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will |
1240 | // stall on the border crossing since the existing child agent will still have the last movement | 1449 | // stall on the border crossing since the existing child agent will still have the last movement |
1241 | // recorded, which stops the input from being processed. | 1450 | // recorded, which stops the input from being processed. |
1242 | 1451 | MovementFlag = ForceUpdateMovementFlagValue; | |
1243 | MovementFlag = 0; | ||
1244 | 1452 | ||
1245 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 1453 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
1246 | m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1454 | m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
@@ -1248,6 +1456,70 @@ no information to check this | |||
1248 | return true; | 1456 | return true; |
1249 | } | 1457 | } |
1250 | 1458 | ||
1459 | private void RestartAttachmentScripts() | ||
1460 | { | ||
1461 | // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT | ||
1462 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | ||
1463 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | ||
1464 | // not transporting the required data. | ||
1465 | // | ||
1466 | // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of | ||
1467 | // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here | ||
1468 | // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status. | ||
1469 | // | ||
1470 | // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts(). | ||
1471 | // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing | ||
1472 | // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the | ||
1473 | // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine. | ||
1474 | List<SceneObjectGroup> attachments = GetAttachments(); | ||
1475 | |||
1476 | m_log.DebugFormat( | ||
1477 | "[SCENE PRESENCE]: Restarting scripts in {0} attachments for {1} in {2}", attachments.Count, Name, Scene.Name); | ||
1478 | |||
1479 | // Resume scripts | ||
1480 | foreach (SceneObjectGroup sog in attachments) | ||
1481 | { | ||
1482 | sog.ScheduleGroupForFullUpdate(); | ||
1483 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | ||
1484 | sog.ResumeScripts(); | ||
1485 | } | ||
1486 | } | ||
1487 | |||
1488 | private static bool IsRealLogin(TeleportFlags teleportFlags) | ||
1489 | { | ||
1490 | return ((teleportFlags & TeleportFlags.ViaLogin) != 0) && ((teleportFlags & TeleportFlags.ViaHGLogin) == 0); | ||
1491 | } | ||
1492 | |||
1493 | /// <summary> | ||
1494 | /// Force viewers to show the avatar's current name. | ||
1495 | /// </summary> | ||
1496 | /// <remarks> | ||
1497 | /// The avatar name that is shown above the avatar in the viewers is sent in ObjectUpdate packets, | ||
1498 | /// and they get the name from the ScenePresence. Unfortunately, viewers have a bug (as of April 2014) | ||
1499 | /// where they ignore changes to the avatar name. However, tey don't ignore changes to the avatar's | ||
1500 | /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing | ||
1501 | /// the group title (to "(Loading)"), and then restoring it. | ||
1502 | /// </remarks> | ||
1503 | public void ForceViewersUpdateName() | ||
1504 | { | ||
1505 | m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name); | ||
1506 | |||
1507 | UseFakeGroupTitle = true; | ||
1508 | SendAvatarDataToAllClients(false); | ||
1509 | |||
1510 | Util.FireAndForget(o => | ||
1511 | { | ||
1512 | // Viewers only update the avatar name when idle. Therefore, we must wait long | ||
1513 | // enough for the viewer to show the fake name that we had set above, and only | ||
1514 | // then switch back to the true name. This delay was chosen because it has a high | ||
1515 | // chance of succeeding (we don't want to choose a value that's too low). | ||
1516 | Thread.Sleep(5000); | ||
1517 | |||
1518 | UseFakeGroupTitle = false; | ||
1519 | SendAvatarDataToAllClients(false); | ||
1520 | }, null, "Scenepresence.ForceViewersUpdateName"); | ||
1521 | } | ||
1522 | |||
1251 | public int GetStateSource() | 1523 | public int GetStateSource() |
1252 | { | 1524 | { |
1253 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); | 1525 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); |
@@ -1285,6 +1557,11 @@ no information to check this | |||
1285 | lock (m_originRegionIDAccessLock) | 1557 | lock (m_originRegionIDAccessLock) |
1286 | m_originRegionID = UUID.Zero; | 1558 | m_originRegionID = UUID.Zero; |
1287 | 1559 | ||
1560 | // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating | ||
1561 | // from the source simulator has completed on a V2 teleport. | ||
1562 | lock (m_originRegionIDAccessLock) | ||
1563 | m_originRegionID = UUID.Zero; | ||
1564 | |||
1288 | // Reset these so that teleporting in and walking out isn't seen | 1565 | // Reset these so that teleporting in and walking out isn't seen |
1289 | // as teleporting back | 1566 | // as teleporting back |
1290 | TeleportFlags = TeleportFlags.Default; | 1567 | TeleportFlags = TeleportFlags.Default; |
@@ -1332,9 +1609,9 @@ no information to check this | |||
1332 | if (PhysicsActor != null) | 1609 | if (PhysicsActor != null) |
1333 | { | 1610 | { |
1334 | // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 1611 | // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
1612 | PhysicsActor.UnSubscribeEvents(); | ||
1335 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; | 1613 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; |
1336 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | 1614 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
1337 | PhysicsActor.UnSubscribeEvents(); | ||
1338 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 1615 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
1339 | PhysicsActor = null; | 1616 | PhysicsActor = null; |
1340 | } | 1617 | } |
@@ -1372,8 +1649,6 @@ no information to check this | |||
1372 | else | 1649 | else |
1373 | PhysicsActor.SetMomentum(vel); | 1650 | PhysicsActor.SetMomentum(vel); |
1374 | } | 1651 | } |
1375 | |||
1376 | SendTerseUpdateToAllClients(); | ||
1377 | } | 1652 | } |
1378 | 1653 | ||
1379 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) | 1654 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) |
@@ -1405,12 +1680,8 @@ no information to check this | |||
1405 | } | 1680 | } |
1406 | } | 1681 | } |
1407 | } | 1682 | } |
1408 | |||
1409 | SendTerseUpdateToAllClients(); | ||
1410 | } | 1683 | } |
1411 | 1684 | ||
1412 | |||
1413 | |||
1414 | public void StopFlying() | 1685 | public void StopFlying() |
1415 | { | 1686 | { |
1416 | if (IsInTransit) | 1687 | if (IsInTransit) |
@@ -1644,8 +1915,17 @@ no information to check this | |||
1644 | public void SetSize(Vector3 size, float feetoffset) | 1915 | public void SetSize(Vector3 size, float feetoffset) |
1645 | { | 1916 | { |
1646 | if (PhysicsActor != null && !IsChildAgent) | 1917 | if (PhysicsActor != null && !IsChildAgent) |
1918 | <<<<<<< HEAD | ||
1919 | { | ||
1920 | // Eventually there will be a physics call that sets avatar size that includes offset info. | ||
1921 | // For the moment, just set the size as passed. | ||
1922 | PhysicsActor.Size = size; | ||
1923 | // PhysicsActor.setAvatarSize(size, feetoffset); | ||
1924 | } | ||
1925 | ======= | ||
1647 | PhysicsActor.setAvatarSize(size, feetoffset); | 1926 | PhysicsActor.setAvatarSize(size, feetoffset); |
1648 | 1927 | ||
1928 | >>>>>>> avn/ubitvar | ||
1649 | } | 1929 | } |
1650 | 1930 | ||
1651 | private bool WaitForUpdateAgent(IClientAPI client) | 1931 | private bool WaitForUpdateAgent(IClientAPI client) |
@@ -1654,20 +1934,12 @@ no information to check this | |||
1654 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, | 1934 | // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, |
1655 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the | 1935 | // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the |
1656 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero | 1936 | // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero |
1657 | int count = 50; | 1937 | m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); |
1658 | UUID originID; | ||
1659 | 1938 | ||
1660 | lock (m_originRegionIDAccessLock) | 1939 | UUID originID = UUID.Zero; |
1661 | originID = m_originRegionID; | ||
1662 | |||
1663 | while (originID.Equals(UUID.Zero) && count-- > 0) | ||
1664 | { | ||
1665 | lock (m_originRegionIDAccessLock) | ||
1666 | originID = m_originRegionID; | ||
1667 | 1940 | ||
1668 | m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); | 1941 | lock (m_originRegionIDAccessLock) |
1669 | Thread.Sleep(200); | 1942 | originID = m_originRegionID; |
1670 | } | ||
1671 | 1943 | ||
1672 | if (originID.Equals(UUID.Zero)) | 1944 | if (originID.Equals(UUID.Zero)) |
1673 | { | 1945 | { |
@@ -1698,6 +1970,40 @@ no information to check this | |||
1698 | 1970 | ||
1699 | m_inTransit = true; | 1971 | m_inTransit = true; |
1700 | 1972 | ||
1973 | <<<<<<< HEAD | ||
1974 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags' | ||
1975 | |||
1976 | IsInTransit = true; | ||
1977 | try | ||
1978 | { | ||
1979 | // Make sure it's not a login agent. We don't want to wait for updates during login | ||
1980 | if (!(PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags))) | ||
1981 | { | ||
1982 | // Let's wait until UpdateAgent (called by departing region) is done | ||
1983 | if (!WaitForUpdateAgent(client)) | ||
1984 | // The sending region never sent the UpdateAgent data, we have to refuse | ||
1985 | return; | ||
1986 | } | ||
1987 | |||
1988 | Vector3 look = Velocity; | ||
1989 | |||
1990 | // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | ||
1991 | if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1)) | ||
1992 | { | ||
1993 | look = new Vector3(0.99f, 0.042f, 0); | ||
1994 | } | ||
1995 | |||
1996 | // Prevent teleporting to an underground location | ||
1997 | // (may crash client otherwise) | ||
1998 | // | ||
1999 | Vector3 pos = AbsolutePosition; | ||
2000 | float ground = m_scene.GetGroundHeight(pos.X, pos.Y); | ||
2001 | if (pos.Z < ground + 1.5f) | ||
2002 | { | ||
2003 | pos.Z = ground + 1.5f; | ||
2004 | AbsolutePosition = pos; | ||
2005 | } | ||
2006 | ======= | ||
1701 | try | 2007 | try |
1702 | { | 2008 | { |
1703 | // Make sure it's not a login agent. We don't want to wait for updates during login | 2009 | // Make sure it's not a login agent. We don't want to wait for updates during login |
@@ -1713,16 +2019,103 @@ no information to check this | |||
1713 | m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2019 | m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1714 | 2020 | ||
1715 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 2021 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
2022 | >>>>>>> avn/ubitvar | ||
1716 | 2023 | ||
1717 | if (!MakeRootAgent(AbsolutePosition, flying)) | 2024 | if (!MakeRootAgent(AbsolutePosition, flying)) |
1718 | { | 2025 | { |
1719 | m_log.DebugFormat( | 2026 | m_log.DebugFormat( |
2027 | <<<<<<< HEAD | ||
2028 | "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", | ||
2029 | ======= | ||
1720 | "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", | 2030 | "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", |
2031 | >>>>>>> avn/ubitvar | ||
1721 | Name, Scene.Name); | 2032 | Name, Scene.Name); |
1722 | 2033 | ||
1723 | return; | 2034 | return; |
1724 | } | 2035 | } |
1725 | 2036 | ||
2037 | <<<<<<< HEAD | ||
2038 | // Tell the client that we're totally ready | ||
2039 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
2040 | |||
2041 | // Child agents send initial data up in LLUDPServer.HandleUseCircuitCode() | ||
2042 | if (!SentInitialDataToClient) | ||
2043 | SendInitialDataToClient(); | ||
2044 | |||
2045 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
2046 | |||
2047 | if (!string.IsNullOrEmpty(m_callbackURI)) | ||
2048 | { | ||
2049 | // We cannot sleep here since this would hold up the inbound packet processing thread, as | ||
2050 | // CompleteMovement() is executed synchronously. However, it might be better to delay the release | ||
2051 | // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete | ||
2052 | // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this | ||
2053 | // region as the current region, meaning that a close sent before then will fail the teleport. | ||
2054 | // System.Threading.Thread.Sleep(2000); | ||
2055 | |||
2056 | m_log.DebugFormat( | ||
2057 | "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", | ||
2058 | client.Name, client.AgentId, m_callbackURI); | ||
2059 | |||
2060 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); | ||
2061 | m_callbackURI = null; | ||
2062 | } | ||
2063 | // else | ||
2064 | // { | ||
2065 | // m_log.DebugFormat( | ||
2066 | // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", | ||
2067 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | ||
2068 | // } | ||
2069 | |||
2070 | ValidateAndSendAppearanceAndAgentData(); | ||
2071 | |||
2072 | // Create child agents in neighbouring regions | ||
2073 | if (openChildAgents && !IsChildAgent) | ||
2074 | { | ||
2075 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
2076 | if (m_agentTransfer != null) | ||
2077 | { | ||
2078 | // Note: this call can take a while, because it notifies each of the simulator's neighbours. | ||
2079 | // It's important that we don't allow the avatar to cross regions meanwhile, as that will | ||
2080 | // cause serious errors. We've prevented that from happening by setting IsInTransit=true. | ||
2081 | m_agentTransfer.EnableChildAgents(this); | ||
2082 | } | ||
2083 | |||
2084 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
2085 | if (friendsModule != null) | ||
2086 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | ||
2087 | |||
2088 | } | ||
2089 | |||
2090 | // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region | ||
2091 | // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work. | ||
2092 | // This may be due to viewer code or it may be something we're not doing properly simulator side. | ||
2093 | WorkManager.RunJob( | ||
2094 | "ScheduleAttachmentsForFullUpdate", | ||
2095 | o => ScheduleAttachmentsForFullUpdate(), | ||
2096 | null, | ||
2097 | string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name), | ||
2098 | true); | ||
2099 | |||
2100 | // m_log.DebugFormat( | ||
2101 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | ||
2102 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); | ||
2103 | } | ||
2104 | finally | ||
2105 | { | ||
2106 | IsInTransit = false; | ||
2107 | } | ||
2108 | } | ||
2109 | |||
2110 | private void ScheduleAttachmentsForFullUpdate() | ||
2111 | { | ||
2112 | lock (m_attachments) | ||
2113 | { | ||
2114 | foreach (SceneObjectGroup sog in m_attachments) | ||
2115 | sog.ScheduleGroupForFullUpdate(); | ||
2116 | } | ||
2117 | } | ||
2118 | ======= | ||
1726 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2119 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1727 | 2120 | ||
1728 | Vector3 look = Lookat; | 2121 | Vector3 look = Lookat; |
@@ -1804,6 +2197,7 @@ no information to check this | |||
1804 | // so sequence is clear | 2197 | // so sequence is clear |
1805 | 2198 | ||
1806 | // verify baked textures and cache | 2199 | // verify baked textures and cache |
2200 | >>>>>>> avn/ubitvar | ||
1807 | 2201 | ||
1808 | 2202 | ||
1809 | bool cachedbaked = false; | 2203 | bool cachedbaked = false; |
@@ -2043,13 +2437,13 @@ no information to check this | |||
2043 | /// </summary> | 2437 | /// </summary> |
2044 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 2438 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
2045 | { | 2439 | { |
2046 | //m_log.DebugFormat( | 2440 | // m_log.DebugFormat( |
2047 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 2441 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
2048 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | 2442 | // Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
2049 | 2443 | ||
2050 | if (IsChildAgent) | 2444 | if (IsChildAgent) |
2051 | { | 2445 | { |
2052 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 2446 | // m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name); |
2053 | return; | 2447 | return; |
2054 | } | 2448 | } |
2055 | 2449 | ||
@@ -2090,13 +2484,23 @@ no information to check this | |||
2090 | // When we get to the point of re-computing neighbors everytime this | 2484 | // When we get to the point of re-computing neighbors everytime this |
2091 | // changes, then start using the agent's drawdistance rather than the | 2485 | // changes, then start using the agent's drawdistance rather than the |
2092 | // region's draw distance. | 2486 | // region's draw distance. |
2487 | <<<<<<< HEAD | ||
2488 | DrawDistance = agentData.Far; | ||
2489 | // DrawDistance = Scene.DefaultDrawDistance; | ||
2490 | ======= | ||
2093 | 2491 | ||
2094 | DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); | 2492 | DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); |
2095 | 2493 | ||
2096 | // DrawDistance = Scene.DefaultDrawDistance; | 2494 | // DrawDistance = Scene.DefaultDrawDistance; |
2495 | >>>>>>> avn/ubitvar | ||
2097 | 2496 | ||
2098 | m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; | 2497 | m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; |
2099 | m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; | 2498 | |
2499 | // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button | ||
2500 | // is first pressed, not whilst it is held down. If this is required in the future then need to look | ||
2501 | // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not | ||
2502 | // received (e.g. on holding LMB down on the avatar in a viewer). | ||
2503 | // m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; | ||
2100 | 2504 | ||
2101 | #endregion Inputs | 2505 | #endregion Inputs |
2102 | 2506 | ||
@@ -2188,6 +2592,14 @@ no information to check this | |||
2188 | 2592 | ||
2189 | bool update_movementflag = false; | 2593 | bool update_movementflag = false; |
2190 | 2594 | ||
2595 | // If we were just made root agent then we must perform movement updates for the first AgentUpdate that | ||
2596 | // we get | ||
2597 | if (MovementFlag == ForceUpdateMovementFlagValue) | ||
2598 | { | ||
2599 | MovementFlag = 0; | ||
2600 | update_movementflag = true; | ||
2601 | } | ||
2602 | |||
2191 | if (agentData.UseClientAgentPosition) | 2603 | if (agentData.UseClientAgentPosition) |
2192 | { | 2604 | { |
2193 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; | 2605 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; |
@@ -2219,6 +2631,8 @@ no information to check this | |||
2219 | { | 2631 | { |
2220 | bool bAllowUpdateMoveToPosition = false; | 2632 | bool bAllowUpdateMoveToPosition = false; |
2221 | 2633 | ||
2634 | <<<<<<< HEAD | ||
2635 | ======= | ||
2222 | Vector3[] dirVectors; | 2636 | Vector3[] dirVectors; |
2223 | 2637 | ||
2224 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | 2638 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying |
@@ -2229,6 +2643,7 @@ no information to check this | |||
2229 | dirVectors = Dir_Vectors; | 2643 | dirVectors = Dir_Vectors; |
2230 | 2644 | ||
2231 | 2645 | ||
2646 | >>>>>>> avn/ubitvar | ||
2232 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. | 2647 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. |
2233 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 2648 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
2234 | { | 2649 | { |
@@ -2238,7 +2653,9 @@ no information to check this | |||
2238 | 2653 | ||
2239 | try | 2654 | try |
2240 | { | 2655 | { |
2241 | agent_control_v3 += dirVectors[i]; | 2656 | // Don't slide against ground when crouching if camera is panned around avatar |
2657 | if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN) | ||
2658 | agent_control_v3 += Dir_Vectors[i]; | ||
2242 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); | 2659 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); |
2243 | } | 2660 | } |
2244 | catch (IndexOutOfRangeException) | 2661 | catch (IndexOutOfRangeException) |
@@ -2448,7 +2865,12 @@ no information to check this | |||
2448 | // When we get to the point of re-computing neighbors everytime this | 2865 | // When we get to the point of re-computing neighbors everytime this |
2449 | // changes, then start using the agent's drawdistance rather than the | 2866 | // changes, then start using the agent's drawdistance rather than the |
2450 | // region's draw distance. | 2867 | // region's draw distance. |
2868 | <<<<<<< HEAD | ||
2869 | DrawDistance = agentData.Far; | ||
2870 | // DrawDistance = Scene.DefaultDrawDistance; | ||
2871 | ======= | ||
2451 | DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); | 2872 | DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); |
2873 | >>>>>>> avn/ubitvar | ||
2452 | 2874 | ||
2453 | // Check if Client has camera in 'follow cam' or 'build' mode. | 2875 | // Check if Client has camera in 'follow cam' or 'build' mode. |
2454 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | 2876 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
@@ -2643,6 +3065,8 @@ no information to check this | |||
2643 | || pos.Z < 0) | 3065 | || pos.Z < 0) |
2644 | return; | 3066 | return; |
2645 | 3067 | ||
3068 | Scene targetScene = m_scene; | ||
3069 | |||
2646 | // Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); | 3070 | // Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); |
2647 | // pos += heightAdjust; | 3071 | // pos += heightAdjust; |
2648 | // | 3072 | // |
@@ -2654,6 +3078,8 @@ no information to check this | |||
2654 | // } | 3078 | // } |
2655 | 3079 | ||
2656 | // Get terrain height for sub-region in a megaregion if necessary | 3080 | // Get terrain height for sub-region in a megaregion if necessary |
3081 | <<<<<<< HEAD | ||
3082 | ======= | ||
2657 | int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); | 3083 | int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); |
2658 | int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); | 3084 | int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); |
2659 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); | 3085 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); |
@@ -2662,13 +3088,30 @@ no information to check this | |||
2662 | return; | 3088 | return; |
2663 | UUID target_regionID = target_region.RegionID; | 3089 | UUID target_regionID = target_region.RegionID; |
2664 | Scene targetScene = m_scene; | 3090 | Scene targetScene = m_scene; |
3091 | >>>>>>> avn/ubitvar | ||
3092 | |||
3093 | //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too? | ||
2665 | 3094 | ||
2666 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 3095 | if (regionCombinerModule != null) |
2667 | targetScene = m_scene; | 3096 | { |
3097 | int x = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); | ||
3098 | int y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); | ||
3099 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y); | ||
3100 | |||
3101 | <<<<<<< HEAD | ||
3102 | // If X and Y is NaN, target_region will be null | ||
3103 | if (target_region == null) | ||
3104 | return; | ||
3105 | |||
3106 | SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene); | ||
3107 | } | ||
2668 | 3108 | ||
2669 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; | 3109 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; |
3110 | ======= | ||
3111 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; | ||
2670 | // dont try to land underground | 3112 | // dont try to land underground |
2671 | terrainHeight += Appearance.AvatarHeight / 2; | 3113 | terrainHeight += Appearance.AvatarHeight / 2; |
3114 | >>>>>>> avn/ubitvar | ||
2672 | pos.Z = Math.Max(terrainHeight, pos.Z); | 3115 | pos.Z = Math.Max(terrainHeight, pos.Z); |
2673 | 3116 | ||
2674 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is | 3117 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is |
@@ -2677,16 +3120,26 @@ no information to check this | |||
2677 | if (pos.Z - terrainHeight < 0.2) | 3120 | if (pos.Z - terrainHeight < 0.2) |
2678 | pos.Z = terrainHeight; | 3121 | pos.Z = terrainHeight; |
2679 | 3122 | ||
3123 | <<<<<<< HEAD | ||
3124 | ======= | ||
2680 | // m_log.DebugFormat( | 3125 | // m_log.DebugFormat( |
2681 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", | 3126 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", |
2682 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | 3127 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); |
2683 | 3128 | ||
2684 | 3129 | ||
3130 | >>>>>>> avn/ubitvar | ||
2685 | if (noFly) | 3131 | if (noFly) |
2686 | Flying = false; | 3132 | Flying = false; |
2687 | else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying) | 3133 | else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying) |
2688 | Flying = true; | 3134 | Flying = true; |
2689 | 3135 | ||
3136 | // m_log.DebugFormat( | ||
3137 | // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", | ||
3138 | // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | ||
3139 | |||
3140 | if (noFly) | ||
3141 | Flying = false; | ||
3142 | |||
2690 | LandAtTarget = landAtTarget; | 3143 | LandAtTarget = landAtTarget; |
2691 | MovingToTarget = true; | 3144 | MovingToTarget = true; |
2692 | MoveToPositionTarget = pos; | 3145 | MoveToPositionTarget = pos; |
@@ -2761,10 +3214,13 @@ no information to check this | |||
2761 | } | 3214 | } |
2762 | } | 3215 | } |
2763 | 3216 | ||
3217 | <<<<<<< HEAD | ||
3218 | ======= | ||
2764 | part.ParentGroup.DeleteAvatar(UUID); | 3219 | part.ParentGroup.DeleteAvatar(UUID); |
2765 | 3220 | ||
2766 | Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; | 3221 | Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; |
2767 | Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; | 3222 | Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; |
3223 | >>>>>>> avn/ubitvar | ||
2768 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 3224 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
2769 | 3225 | ||
2770 | ParentID = 0; | 3226 | ParentID = 0; |
@@ -2792,9 +3248,24 @@ no information to check this | |||
2792 | standRotationZ.Z = 0f; | 3248 | standRotationZ.Z = 0f; |
2793 | } | 3249 | } |
2794 | 3250 | ||
3251 | <<<<<<< HEAD | ||
3252 | //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | ||
3253 | //Vector3 standPos = ParentPosition; | ||
3254 | |||
3255 | // Vector3 standPositionAdjustment | ||
3256 | // = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); | ||
3257 | Vector3 adjustmentForSitPosition = OffsetPosition * part.ParentGroup.GroupRotation - SIT_TARGET_ADJUSTMENT * part.GetWorldRotation(); | ||
3258 | |||
3259 | // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than | ||
3260 | // hardcoding here. | ||
3261 | Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation; | ||
3262 | |||
3263 | Vector3 standPos = part.ParentGroup.AbsolutePosition + adjustmentForSitPosition + adjustmentForSitPose; | ||
3264 | ======= | ||
2795 | Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; | 3265 | Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; |
2796 | 3266 | ||
2797 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; | 3267 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; |
3268 | >>>>>>> avn/ubitvar | ||
2798 | 3269 | ||
2799 | m_pos = standPos; | 3270 | m_pos = standPos; |
2800 | } | 3271 | } |
@@ -2806,8 +3277,16 @@ no information to check this | |||
2806 | 3277 | ||
2807 | if (satOnObject) | 3278 | if (satOnObject) |
2808 | { | 3279 | { |
3280 | <<<<<<< HEAD | ||
3281 | SendAvatarDataToAllClients(); | ||
3282 | m_requestedSitTargetID = 0; | ||
3283 | |||
3284 | part.RemoveSittingAvatar(this); | ||
3285 | |||
3286 | ======= | ||
2809 | m_requestedSitTargetID = 0; | 3287 | m_requestedSitTargetID = 0; |
2810 | part.RemoveSittingAvatar(UUID); | 3288 | part.RemoveSittingAvatar(UUID); |
3289 | >>>>>>> avn/ubitvar | ||
2811 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3290 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
2812 | 3291 | ||
2813 | SendAvatarDataToAllAgents(); | 3292 | SendAvatarDataToAllAgents(); |
@@ -2907,10 +3386,37 @@ no information to check this | |||
2907 | 3386 | ||
2908 | Velocity = Vector3.Zero; | 3387 | Velocity = Vector3.Zero; |
2909 | 3388 | ||
2910 | part.AddSittingAvatar(UUID); | 3389 | part.AddSittingAvatar(this); |
2911 | 3390 | ||
2912 | cameraAtOffset = part.GetCameraAtOffset(); | 3391 | cameraAtOffset = part.GetCameraAtOffset(); |
3392 | |||
3393 | if (!part.IsRoot && cameraAtOffset == Vector3.Zero) | ||
3394 | cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); | ||
3395 | |||
3396 | bool cameraEyeOffsetFromRootForChild = false; | ||
2913 | cameraEyeOffset = part.GetCameraEyeOffset(); | 3397 | cameraEyeOffset = part.GetCameraEyeOffset(); |
3398 | |||
3399 | if (!part.IsRoot && cameraEyeOffset == Vector3.Zero) | ||
3400 | { | ||
3401 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); | ||
3402 | cameraEyeOffsetFromRootForChild = true; | ||
3403 | } | ||
3404 | |||
3405 | if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero) | ||
3406 | { | ||
3407 | if (!part.IsRoot) | ||
3408 | { | ||
3409 | cameraEyeOffset = cameraEyeOffset * part.RotationOffset; | ||
3410 | cameraAtOffset += part.OffsetPosition; | ||
3411 | } | ||
3412 | |||
3413 | cameraEyeOffset += part.OffsetPosition; | ||
3414 | } | ||
3415 | |||
3416 | // m_log.DebugFormat( | ||
3417 | // "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}", | ||
3418 | // cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name); | ||
3419 | |||
2914 | forceMouselook = part.GetForceMouselook(); | 3420 | forceMouselook = part.GetForceMouselook(); |
2915 | 3421 | ||
2916 | if (!part.IsRoot) | 3422 | if (!part.IsRoot) |
@@ -3054,7 +3560,7 @@ no information to check this | |||
3054 | Velocity = Vector3.Zero; | 3560 | Velocity = Vector3.Zero; |
3055 | m_AngularVelocity = Vector3.Zero; | 3561 | m_AngularVelocity = Vector3.Zero; |
3056 | 3562 | ||
3057 | part.AddSittingAvatar(UUID); | 3563 | part.AddSittingAvatar(this); |
3058 | 3564 | ||
3059 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); | 3565 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); |
3060 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 3566 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
@@ -3090,7 +3596,6 @@ no information to check this | |||
3090 | 3596 | ||
3091 | 3597 | ||
3092 | m_requestedSitTargetID = 0; | 3598 | m_requestedSitTargetID = 0; |
3093 | part.ParentGroup.AddAvatar(UUID); | ||
3094 | 3599 | ||
3095 | ParentPart = part; | 3600 | ParentPart = part; |
3096 | ParentID = part.LocalId; | 3601 | ParentID = part.LocalId; |
@@ -3102,6 +3607,9 @@ no information to check this | |||
3102 | Animator.TrySetMovementAnimation("SIT_GROUND"); | 3607 | Animator.TrySetMovementAnimation("SIT_GROUND"); |
3103 | else | 3608 | else |
3104 | Animator.TrySetMovementAnimation("SIT"); | 3609 | Animator.TrySetMovementAnimation("SIT"); |
3610 | <<<<<<< HEAD | ||
3611 | SendAvatarDataToAllClients(); | ||
3612 | ======= | ||
3105 | */ | 3613 | */ |
3106 | if (status == 3) | 3614 | if (status == 3) |
3107 | sitAnimation = "SIT_GROUND"; | 3615 | sitAnimation = "SIT_GROUND"; |
@@ -3109,11 +3617,11 @@ no information to check this | |||
3109 | sitAnimation = "SIT"; | 3617 | sitAnimation = "SIT"; |
3110 | 3618 | ||
3111 | Animator.SetMovementAnimations("SIT"); | 3619 | Animator.SetMovementAnimations("SIT"); |
3620 | >>>>>>> avn/ubitvar | ||
3112 | 3621 | ||
3113 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3622 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
3114 | } | 3623 | } |
3115 | 3624 | ||
3116 | |||
3117 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 3625 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
3118 | { | 3626 | { |
3119 | if (IsChildAgent) | 3627 | if (IsChildAgent) |
@@ -3132,7 +3640,6 @@ no information to check this | |||
3132 | return; | 3640 | return; |
3133 | } | 3641 | } |
3134 | 3642 | ||
3135 | |||
3136 | if (part.SitTargetAvatar == UUID) | 3643 | if (part.SitTargetAvatar == UUID) |
3137 | { | 3644 | { |
3138 | Vector3 sitTargetPos = part.SitTargetPosition; | 3645 | Vector3 sitTargetPos = part.SitTargetPosition; |
@@ -3147,28 +3654,40 @@ no information to check this | |||
3147 | 3654 | ||
3148 | //Quaternion result = (sitTargetOrient * vq) * nq; | 3655 | //Quaternion result = (sitTargetOrient * vq) * nq; |
3149 | 3656 | ||
3150 | double x, y, z, m; | 3657 | double x, y, z, m1, m2; |
3151 | 3658 | ||
3152 | Quaternion r = sitTargetOrient; | 3659 | Quaternion r = sitTargetOrient; |
3153 | m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; | 3660 | m1 = r.X * r.X + r.Y * r.Y; |
3154 | 3661 | m2 = r.Z * r.Z + r.W * r.W; | |
3155 | if (Math.Abs(1.0 - m) > 0.000001) | ||
3156 | { | ||
3157 | m = 1.0 / Math.Sqrt(m); | ||
3158 | r.X *= (float)m; | ||
3159 | r.Y *= (float)m; | ||
3160 | r.Z *= (float)m; | ||
3161 | r.W *= (float)m; | ||
3162 | } | ||
3163 | 3662 | ||
3663 | // Rotate the vector <0, 0, 1> | ||
3164 | x = 2 * (r.X * r.Z + r.Y * r.W); | 3664 | x = 2 * (r.X * r.Z + r.Y * r.W); |
3165 | y = 2 * (-r.X * r.W + r.Y * r.Z); | 3665 | y = 2 * (-r.X * r.W + r.Y * r.Z); |
3166 | z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; | 3666 | z = m2 - m1; |
3667 | |||
3668 | // Set m to be the square of the norm of r. | ||
3669 | double m = m1 + m2; | ||
3670 | |||
3671 | // This constant is emperically determined to be what is used in SL. | ||
3672 | // See also http://opensimulator.org/mantis/view.php?id=7096 | ||
3673 | double offset = 0.05; | ||
3674 | |||
3675 | // Normally m will be ~ 1, but if someone passed a handcrafted quaternion | ||
3676 | // to llSitTarget with values so small that squaring them is rounded off | ||
3677 | // to zero, then m could be zero. The result of this floating point | ||
3678 | // round off error (causing us to skip this impossible normalization) | ||
3679 | // is only 5 cm. | ||
3680 | if (m > 0.000001) | ||
3681 | { | ||
3682 | offset /= m; | ||
3683 | } | ||
3167 | 3684 | ||
3168 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | 3685 | Vector3 up = new Vector3((float)x, (float)y, (float)z); |
3169 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; | 3686 | Vector3 sitOffset = up * (float)offset; |
3170 | 3687 | ||
3171 | Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; | 3688 | // sitOffset is in Avatar Center coordinates: from origin to 'sitTargetPos + SIT_TARGET_ADJUSTMENT'. |
3689 | // So, we need to _substract_ it to get to the origin of the Avatar Center. | ||
3690 | Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; | ||
3172 | Quaternion newRot; | 3691 | Quaternion newRot; |
3173 | 3692 | ||
3174 | if (part.IsRoot) | 3693 | if (part.IsRoot) |
@@ -3201,8 +3720,7 @@ no information to check this | |||
3201 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); | 3720 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); |
3202 | } | 3721 | } |
3203 | 3722 | ||
3204 | part.ParentGroup.AddAvatar(UUID); | 3723 | ParentPart = part; |
3205 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | ||
3206 | ParentID = m_requestedSitTargetID; | 3724 | ParentID = m_requestedSitTargetID; |
3207 | m_AngularVelocity = Vector3.Zero; | 3725 | m_AngularVelocity = Vector3.Zero; |
3208 | Velocity = Vector3.Zero; | 3726 | Velocity = Vector3.Zero; |
@@ -3215,8 +3733,13 @@ no information to check this | |||
3215 | { | 3733 | { |
3216 | sitAnimation = part.SitAnimation; | 3734 | sitAnimation = part.SitAnimation; |
3217 | } | 3735 | } |
3736 | <<<<<<< HEAD | ||
3737 | Animator.TrySetMovementAnimation(sitAnimation); | ||
3738 | SendAvatarDataToAllClients(); | ||
3739 | ======= | ||
3218 | // Animator.TrySetMovementAnimation(sitAnimation); | 3740 | // Animator.TrySetMovementAnimation(sitAnimation); |
3219 | Animator.SetMovementAnimations("SIT"); | 3741 | Animator.SetMovementAnimations("SIT"); |
3742 | >>>>>>> avn/ubitvar | ||
3220 | TriggerScenePresenceUpdated(); | 3743 | TriggerScenePresenceUpdated(); |
3221 | } | 3744 | } |
3222 | } | 3745 | } |
@@ -3278,10 +3801,25 @@ no information to check this | |||
3278 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", | 3801 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", |
3279 | // vec, Rotation, thisAddSpeedModifier, Name); | 3802 | // vec, Rotation, thisAddSpeedModifier, Name); |
3280 | 3803 | ||
3804 | <<<<<<< HEAD | ||
3805 | Quaternion rot = Rotation; | ||
3806 | if (!Flying && PresenceType != PresenceType.Npc) | ||
3807 | { | ||
3808 | // The only situation in which we care about X and Y is avatar flying. The rest of the time | ||
3809 | // these parameters are not relevant for determining avatar movement direction and cause issues such | ||
3810 | // as wrong walk speed if the camera is rotated. | ||
3811 | rot.X = 0; | ||
3812 | rot.Y = 0; | ||
3813 | rot.Normalize(); | ||
3814 | } | ||
3815 | |||
3816 | Vector3 direc = vec * rot; | ||
3817 | ======= | ||
3281 | // rotate from avatar coord space to world | 3818 | // rotate from avatar coord space to world |
3282 | // for now all controls assume this is only a rotation around Z | 3819 | // for now all controls assume this is only a rotation around Z |
3283 | // if not all checks below need to be done before this rotation | 3820 | // if not all checks below need to be done before this rotation |
3284 | Vector3 direc = vec * Rotation; | 3821 | Vector3 direc = vec * Rotation; |
3822 | >>>>>>> avn/ubitvar | ||
3285 | direc.Normalize(); | 3823 | direc.Normalize(); |
3286 | 3824 | ||
3287 | // mouse look situation ? | 3825 | // mouse look situation ? |
@@ -3331,10 +3869,6 @@ no information to check this | |||
3331 | 3869 | ||
3332 | public override void Update() | 3870 | public override void Update() |
3333 | { | 3871 | { |
3334 | const float ROTATION_TOLERANCE = 0.01f; | ||
3335 | const float VELOCITY_TOLERANCE = 0.001f; | ||
3336 | const float POSITION_TOLERANCE = 0.05f; | ||
3337 | |||
3338 | if (IsChildAgent == false) | 3872 | if (IsChildAgent == false) |
3339 | { | 3873 | { |
3340 | CheckForBorderCrossing(); | 3874 | CheckForBorderCrossing(); |
@@ -3346,11 +3880,21 @@ no information to check this | |||
3346 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 3880 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
3347 | // storing a requested force instead of an actual traveling velocity | 3881 | // storing a requested force instead of an actual traveling velocity |
3348 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) | 3882 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) |
3349 | SendAvatarDataToAllAgents(); | 3883 | SendAvatarDataToAllClients(); |
3350 | 3884 | ||
3351 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 3885 | // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very |
3352 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 3886 | // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance |
3353 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3887 | // checks on all updates but the ramifications of this would need careful consideration. |
3888 | bool updateClients | ||
3889 | = IsSatOnObject && (Rotation != m_lastRotation || Velocity != m_lastVelocity || m_pos != m_lastPosition); | ||
3890 | |||
3891 | if (!updateClients) | ||
3892 | updateClients | ||
3893 | = !Rotation.ApproxEquals(m_lastRotation, Scene.RootRotationUpdateTolerance) | ||
3894 | || !Velocity.ApproxEquals(m_lastVelocity, Scene.RootVelocityUpdateTolerance) | ||
3895 | || !m_pos.ApproxEquals(m_lastPosition, Scene.RootPositionUpdateTolerance); | ||
3896 | |||
3897 | if (updateClients) | ||
3354 | { | 3898 | { |
3355 | SendTerseUpdateToAllClients(); | 3899 | SendTerseUpdateToAllClients(); |
3356 | 3900 | ||
@@ -3360,6 +3904,12 @@ no information to check this | |||
3360 | m_lastVelocity = Velocity; | 3904 | m_lastVelocity = Velocity; |
3361 | } | 3905 | } |
3362 | 3906 | ||
3907 | <<<<<<< HEAD | ||
3908 | if (Scene.AllowAvatarCrossing) | ||
3909 | CheckForBorderCrossing(); | ||
3910 | |||
3911 | ======= | ||
3912 | >>>>>>> avn/ubitvar | ||
3363 | CheckForSignificantMovement(); // sends update to the modules. | 3913 | CheckForSignificantMovement(); // sends update to the modules. |
3364 | } | 3914 | } |
3365 | } | 3915 | } |
@@ -3368,6 +3918,8 @@ no information to check this | |||
3368 | 3918 | ||
3369 | #region Update Client(s) | 3919 | #region Update Client(s) |
3370 | 3920 | ||
3921 | <<<<<<< HEAD | ||
3922 | ======= | ||
3371 | public void SendUpdateToAgent(ScenePresence p) | 3923 | public void SendUpdateToAgent(ScenePresence p) |
3372 | { | 3924 | { |
3373 | IClientAPI remoteClient = p.ControllingClient; | 3925 | IClientAPI remoteClient = p.ControllingClient; |
@@ -3397,6 +3949,7 @@ no information to check this | |||
3397 | ControllingClient.SendAgentTerseUpdate(p); | 3949 | ControllingClient.SendAgentTerseUpdate(p); |
3398 | } | 3950 | } |
3399 | 3951 | ||
3952 | >>>>>>> avn/ubitvar | ||
3400 | /// <summary> | 3953 | /// <summary> |
3401 | /// Sends a location update to the client connected to this scenePresence | 3954 | /// Sends a location update to the client connected to this scenePresence |
3402 | /// via entity updates | 3955 | /// via entity updates |
@@ -3408,6 +3961,29 @@ no information to check this | |||
3408 | // server. | 3961 | // server. |
3409 | if (remoteClient.IsActive) | 3962 | if (remoteClient.IsActive) |
3410 | { | 3963 | { |
3964 | if (Scene.RootTerseUpdatePeriod > 1) | ||
3965 | { | ||
3966 | // Console.WriteLine( | ||
3967 | // "{0} {1} {2} {3} {4} {5} for {6} to {7}", | ||
3968 | // remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f), Name, remoteClient.Name); | ||
3969 | if (remoteClient.AgentId != UUID | ||
3970 | && !remoteClient.SceneAgent.IsChildAgent | ||
3971 | && m_terseUpdateCount % Scene.RootTerseUpdatePeriod != 0 | ||
3972 | && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) | ||
3973 | { | ||
3974 | // m_log.DebugFormat("[SCENE PRESENCE]: Discarded update from {0} to {1}, args {2} {3} {4} {5} {6} {7}", | ||
3975 | // Name, remoteClient.Name, remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f)); | ||
3976 | |||
3977 | return; | ||
3978 | } | ||
3979 | } | ||
3980 | |||
3981 | if (Scene.ChildTerseUpdatePeriod > 1 | ||
3982 | && remoteClient.SceneAgent.IsChildAgent | ||
3983 | && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0 | ||
3984 | && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) | ||
3985 | return; | ||
3986 | |||
3411 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | 3987 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); |
3412 | remoteClient.SendEntityUpdate( | 3988 | remoteClient.SendEntityUpdate( |
3413 | this, | 3989 | this, |
@@ -3476,7 +4052,11 @@ no information to check this | |||
3476 | float distanceError = Vector3.Distance(OffsetPosition, expectedPosition); | 4052 | float distanceError = Vector3.Distance(OffsetPosition, expectedPosition); |
3477 | 4053 | ||
3478 | float speed = Velocity.Length(); | 4054 | float speed = Velocity.Length(); |
3479 | float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); | 4055 | float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); |
4056 | |||
4057 | // m_log.DebugFormat( | ||
4058 | // "[SCENE PRESENCE]: Delta-v {0}, lastVelocity {1}, Velocity {2} for {3} in {4}", | ||
4059 | // velocidyDiff, lastVelocitySentToAllClients, Velocity, Name, Scene.Name); | ||
3480 | 4060 | ||
3481 | // assuming 5 ms. worst case precision for timer, use 2x that | 4061 | // assuming 5 ms. worst case precision for timer, use 2x that |
3482 | // for distance error threshold | 4062 | // for distance error threshold |
@@ -3484,12 +4064,18 @@ no information to check this | |||
3484 | 4064 | ||
3485 | if (speed < 0.01f // allow rotation updates if avatar position is unchanged | 4065 | if (speed < 0.01f // allow rotation updates if avatar position is unchanged |
3486 | || Math.Abs(distanceError) > distanceErrorThreshold | 4066 | || Math.Abs(distanceError) > distanceErrorThreshold |
3487 | || velocidyDiff > 0.01f) // did velocity change from last update? | 4067 | || velocityDiff > 0.01f) // did velocity change from last update? |
3488 | { | 4068 | { |
4069 | // m_log.DebugFormat( | ||
4070 | // "[SCENE PRESENCE]: Update triggered with speed {0}, distanceError {1}, distanceThreshold {2}, delta-v {3} for {4} in {5}", | ||
4071 | // speed, distanceError, distanceErrorThreshold, velocidyDiff, Name, Scene.Name); | ||
4072 | |||
3489 | lastVelocitySentToAllClients = Velocity; | 4073 | lastVelocitySentToAllClients = Velocity; |
3490 | lastTerseUpdateToAllClientsTick = currentTick; | 4074 | lastTerseUpdateToAllClientsTick = currentTick; |
3491 | lastPositionSentToAllClients = OffsetPosition; | 4075 | lastPositionSentToAllClients = OffsetPosition; |
3492 | 4076 | ||
4077 | m_terseUpdateCount++; | ||
4078 | |||
3493 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); | 4079 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); |
3494 | // m_scene.ForEachClient(SendTerseUpdateToClient); | 4080 | // m_scene.ForEachClient(SendTerseUpdateToClient); |
3495 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | 4081 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); |
@@ -3517,14 +4103,24 @@ no information to check this | |||
3517 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 4103 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
3518 | } | 4104 | } |
3519 | 4105 | ||
3520 | public void SendInitialDataToMe() | 4106 | public void SendInitialDataToClient() |
3521 | { | 4107 | { |
4108 | SentInitialDataToClient = true; | ||
4109 | |||
3522 | // Send all scene object to the new client | 4110 | // Send all scene object to the new client |
3523 | Util.FireAndForget(delegate | 4111 | WorkManager.RunJob("SendInitialDataToClient", delegate |
3524 | { | 4112 | { |
4113 | // m_log.DebugFormat( | ||
4114 | // "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}", | ||
4115 | // IsChildAgent ? "child" : "root", Name, Scene.Name, m_teleportFlags); | ||
4116 | |||
3525 | // we created a new ScenePresence (a new child agent) in a fresh region. | 4117 | // we created a new ScenePresence (a new child agent) in a fresh region. |
3526 | // Request info about all the (root) agents in this region | 4118 | // Request info about all the (root) agents in this region |
3527 | // Note: This won't send data *to* other clients in that region (children don't send) | 4119 | // Note: This won't send data *to* other clients in that region (children don't send) |
4120 | <<<<<<< HEAD | ||
4121 | SendOtherAgentsAvatarDataToClient(); | ||
4122 | SendOtherAgentsAppearanceToClient(); | ||
4123 | ======= | ||
3528 | if (m_teleportFlags <= 0) | 4124 | if (m_teleportFlags <= 0) |
3529 | { | 4125 | { |
3530 | ILandChannel landch = m_scene.LandChannel; | 4126 | ILandChannel landch = m_scene.LandChannel; |
@@ -3533,6 +4129,7 @@ no information to check this | |||
3533 | landch.sendClientInitialLandInfo(ControllingClient); | 4129 | landch.sendClientInitialLandInfo(ControllingClient); |
3534 | } | 4130 | } |
3535 | } | 4131 | } |
4132 | >>>>>>> avn/ubitvar | ||
3536 | 4133 | ||
3537 | SendOtherAgentsAvatarFullToMe(); | 4134 | SendOtherAgentsAvatarFullToMe(); |
3538 | EntityBase[] entities = Scene.Entities.GetEntities(); | 4135 | EntityBase[] entities = Scene.Entities.GetEntities(); |
@@ -3541,7 +4138,11 @@ no information to check this | |||
3541 | if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) | 4138 | if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) |
3542 | ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); | 4139 | ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); |
3543 | } | 4140 | } |
4141 | <<<<<<< HEAD | ||
4142 | }, null, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name), false, true); | ||
4143 | ======= | ||
3544 | }); | 4144 | }); |
4145 | >>>>>>> avn/ubitvar | ||
3545 | } | 4146 | } |
3546 | 4147 | ||
3547 | /// <summary> | 4148 | /// <summary> |
@@ -3570,6 +4171,17 @@ no information to check this | |||
3570 | if (m_scene.AvatarFactory != null) | 4171 | if (m_scene.AvatarFactory != null) |
3571 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 4172 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
3572 | } | 4173 | } |
4174 | <<<<<<< HEAD | ||
4175 | |||
4176 | // This agent just became root. We are going to tell everyone about it. The process of | ||
4177 | // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it | ||
4178 | // again here... this comes after the cached appearance check because the avatars | ||
4179 | // appearance goes into the avatar update packet | ||
4180 | SendAvatarDataToAllClients(); | ||
4181 | |||
4182 | // This invocation always shows up in the viewer logs as an error. Is it needed? | ||
4183 | SendAppearanceToClient(this); | ||
4184 | ======= | ||
3573 | 4185 | ||
3574 | // send avatar object to all viewers so they cross it into region | 4186 | // send avatar object to all viewers so they cross it into region |
3575 | bool newhide = m_currentParcelHide; | 4187 | bool newhide = m_currentParcelHide; |
@@ -3585,6 +4197,7 @@ no information to check this | |||
3585 | } | 4197 | } |
3586 | 4198 | ||
3587 | SendAppearanceToAgent(this); | 4199 | SendAppearanceToAgent(this); |
4200 | >>>>>>> avn/ubitvar | ||
3588 | 4201 | ||
3589 | m_inTransit = false; | 4202 | m_inTransit = false; |
3590 | 4203 | ||
@@ -3607,6 +4220,13 @@ no information to check this | |||
3607 | if (p.UUID == UUID) | 4220 | if (p.UUID == UUID) |
3608 | return; | 4221 | return; |
3609 | 4222 | ||
4223 | <<<<<<< HEAD | ||
4224 | // If the avatars baked textures are all in the cache, then we have a | ||
4225 | // complete appearance... send it out, if not, then we'll send it when | ||
4226 | // the avatar finishes updating its appearance | ||
4227 | SendAppearanceToAllOtherClients(); | ||
4228 | } | ||
4229 | ======= | ||
3610 | // get the avatar, then a kill if can't see it | 4230 | // get the avatar, then a kill if can't see it |
3611 | p.SendInitialAvatarDataToAgent(this); | 4231 | p.SendInitialAvatarDataToAgent(this); |
3612 | 4232 | ||
@@ -3620,13 +4240,19 @@ no information to check this | |||
3620 | }); | 4240 | }); |
3621 | 4241 | ||
3622 | m_scene.StatsReporter.AddAgentUpdates(count); | 4242 | m_scene.StatsReporter.AddAgentUpdates(count); |
4243 | >>>>>>> avn/ubitvar | ||
4244 | } | ||
4245 | |||
4246 | public void SendAvatarDataToAllClients() | ||
4247 | { | ||
4248 | SendAvatarDataToAllClients(true); | ||
3623 | } | 4249 | } |
3624 | 4250 | ||
3625 | /// <summary> | 4251 | /// <summary> |
3626 | /// Send this agent's avatar data to all other root and child agents in the scene | 4252 | /// Send this agent's avatar data to all other root and child agents in the scene |
3627 | /// This agent must be root. This avatar will receive its own update. | 4253 | /// This agent must be root. This avatar will receive its own update. |
3628 | /// </summary> | 4254 | /// </summary> |
3629 | public void SendAvatarDataToAllAgents() | 4255 | public void SendAvatarDataToAllClients(bool full) |
3630 | { | 4256 | { |
3631 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); | 4257 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); |
3632 | // only send update from root agents to other clients; children are only "listening posts" | 4258 | // only send update from root agents to other clients; children are only "listening posts" |
@@ -3643,19 +4269,46 @@ no information to check this | |||
3643 | 4269 | ||
3644 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 4270 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
3645 | { | 4271 | { |
4272 | <<<<<<< HEAD | ||
4273 | if (full) | ||
4274 | SendAvatarDataToClient(scenePresence); | ||
4275 | else | ||
4276 | scenePresence.ControllingClient.SendAvatarDataImmediate(this); | ||
4277 | ======= | ||
3646 | SendAvatarDataToAgent(scenePresence); | 4278 | SendAvatarDataToAgent(scenePresence); |
4279 | >>>>>>> avn/ubitvar | ||
3647 | count++; | 4280 | count++; |
3648 | }); | 4281 | }); |
3649 | 4282 | ||
3650 | m_scene.StatsReporter.AddAgentUpdates(count); | 4283 | m_scene.StatsReporter.AddAgentUpdates(count); |
3651 | } | 4284 | } |
3652 | 4285 | ||
4286 | <<<<<<< HEAD | ||
4287 | /// <summary> | ||
4288 | /// Send avatar data for all other root agents to this agent, this agent | ||
4289 | /// can be either a child or root | ||
4290 | /// </summary> | ||
4291 | public void SendOtherAgentsAvatarDataToClient() | ||
4292 | ======= | ||
3653 | // sends avatar object to all clients so they cross it into region | 4293 | // sends avatar object to all clients so they cross it into region |
3654 | // then sends kills to hide | 4294 | // then sends kills to hide |
3655 | public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences) | 4295 | public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences) |
4296 | >>>>>>> avn/ubitvar | ||
3656 | { | 4297 | { |
3657 | m_lastSize = Appearance.AvatarSize; | 4298 | m_lastSize = Appearance.AvatarSize; |
3658 | int count = 0; | 4299 | int count = 0; |
4300 | <<<<<<< HEAD | ||
4301 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | ||
4302 | { | ||
4303 | // only send information about other root agents | ||
4304 | if (scenePresence.UUID == UUID) | ||
4305 | return; | ||
4306 | |||
4307 | scenePresence.SendAvatarDataToClient(this); | ||
4308 | count++; | ||
4309 | }); | ||
4310 | ======= | ||
4311 | >>>>>>> avn/ubitvar | ||
3659 | 4312 | ||
3660 | foreach (ScenePresence p in presences) | 4313 | foreach (ScenePresence p in presences) |
3661 | { | 4314 | { |
@@ -3684,11 +4337,16 @@ no information to check this | |||
3684 | /// Send avatar data to an agent. | 4337 | /// Send avatar data to an agent. |
3685 | /// </summary> | 4338 | /// </summary> |
3686 | /// <param name="avatar"></param> | 4339 | /// <param name="avatar"></param> |
3687 | public void SendAvatarDataToAgent(ScenePresence avatar) | 4340 | public void SendAvatarDataToClient(ScenePresence avatar) |
3688 | { | 4341 | { |
4342 | <<<<<<< HEAD | ||
4343 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToClient from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); | ||
4344 | |||
4345 | ======= | ||
3689 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); | 4346 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); |
3690 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) | 4347 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) |
3691 | return; | 4348 | return; |
4349 | >>>>>>> avn/ubitvar | ||
3692 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 4350 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
3693 | } | 4351 | } |
3694 | 4352 | ||
@@ -3701,9 +4359,13 @@ no information to check this | |||
3701 | /// Send this agent's appearance to all other root and child agents in the scene | 4359 | /// Send this agent's appearance to all other root and child agents in the scene |
3702 | /// This agent must be root. | 4360 | /// This agent must be root. |
3703 | /// </summary> | 4361 | /// </summary> |
3704 | public void SendAppearanceToAllOtherAgents() | 4362 | public void SendAppearanceToAllOtherClients() |
3705 | { | 4363 | { |
4364 | <<<<<<< HEAD | ||
4365 | // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherClients: {0} {1}", Name, UUID); | ||
4366 | ======= | ||
3706 | // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); | 4367 | // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); |
4368 | >>>>>>> avn/ubitvar | ||
3707 | 4369 | ||
3708 | // only send update from root agents to other clients; children are only "listening posts" | 4370 | // only send update from root agents to other clients; children are only "listening posts" |
3709 | if (IsChildAgent) | 4371 | if (IsChildAgent) |
@@ -3722,9 +4384,35 @@ no information to check this | |||
3722 | if (scenePresence.UUID == UUID) | 4384 | if (scenePresence.UUID == UUID) |
3723 | return; | 4385 | return; |
3724 | 4386 | ||
3725 | SendAppearanceToAgent(scenePresence); | 4387 | SendAppearanceToClient(scenePresence); |
3726 | count++; | 4388 | count++; |
3727 | }); | 4389 | }); |
4390 | <<<<<<< HEAD | ||
4391 | |||
4392 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
4393 | } | ||
4394 | |||
4395 | /// <summary> | ||
4396 | /// Send appearance from all other root agents to this agent. this agent | ||
4397 | /// can be either root or child | ||
4398 | /// </summary> | ||
4399 | public void SendOtherAgentsAppearanceToClient() | ||
4400 | { | ||
4401 | // m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToClient {0} {1}", Name, UUID); | ||
4402 | |||
4403 | int count = 0; | ||
4404 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | ||
4405 | { | ||
4406 | // only send information about other root agents | ||
4407 | if (scenePresence.UUID == UUID) | ||
4408 | return; | ||
4409 | |||
4410 | scenePresence.SendAppearanceToClient(this); | ||
4411 | count++; | ||
4412 | }); | ||
4413 | |||
4414 | ======= | ||
4415 | >>>>>>> avn/ubitvar | ||
3728 | m_scene.StatsReporter.AddAgentUpdates(count); | 4416 | m_scene.StatsReporter.AddAgentUpdates(count); |
3729 | } | 4417 | } |
3730 | 4418 | ||
@@ -3732,7 +4420,7 @@ no information to check this | |||
3732 | /// Send appearance data to an agent. | 4420 | /// Send appearance data to an agent. |
3733 | /// </summary> | 4421 | /// </summary> |
3734 | /// <param name="avatar"></param> | 4422 | /// <param name="avatar"></param> |
3735 | public void SendAppearanceToAgent(ScenePresence avatar) | 4423 | public void SendAppearanceToClient(ScenePresence avatar) |
3736 | { | 4424 | { |
3737 | // m_log.DebugFormat( | 4425 | // m_log.DebugFormat( |
3738 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 4426 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
@@ -3858,7 +4546,8 @@ no information to check this | |||
3858 | 4546 | ||
3859 | 4547 | ||
3860 | // Let's get this out of the update loop | 4548 | // Let's get this out of the update loop |
3861 | Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); | 4549 | Util.FireAndForget( |
4550 | o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates"); | ||
3862 | } | 4551 | } |
3863 | } | 4552 | } |
3864 | 4553 | ||
@@ -3885,6 +4574,81 @@ no information to check this | |||
3885 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) | 4574 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) |
3886 | return; | 4575 | return; |
3887 | 4576 | ||
4577 | <<<<<<< HEAD | ||
4578 | if (IsInTransit) | ||
4579 | return; | ||
4580 | |||
4581 | Vector3 pos2 = AbsolutePosition; | ||
4582 | Vector3 origPosition = pos2; | ||
4583 | Vector3 vel = Velocity; | ||
4584 | |||
4585 | // Compute the future avatar position. | ||
4586 | // If the avatar will be crossing, we force the crossing to happen now | ||
4587 | // in the hope that this will make the avatar movement smoother when crossing. | ||
4588 | pos2 += vel * 0.05f; | ||
4589 | |||
4590 | if (m_scene.PositionIsInCurrentRegion(pos2)) | ||
4591 | return; | ||
4592 | |||
4593 | m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}", | ||
4594 | LogHeader, Name, Scene.Name, pos2); | ||
4595 | |||
4596 | // Disconnect from the current region | ||
4597 | bool isFlying = Flying; | ||
4598 | RemoveFromPhysicalScene(); | ||
4599 | |||
4600 | // pos2 is the forcasted position so make that the 'current' position so the crossing | ||
4601 | // code will move us into the newly addressed region. | ||
4602 | m_pos = pos2; | ||
4603 | |||
4604 | if (CrossToNewRegion()) | ||
4605 | { | ||
4606 | AddToPhysicalScene(isFlying); | ||
4607 | } | ||
4608 | else | ||
4609 | { | ||
4610 | // Tried to make crossing happen but it failed. | ||
4611 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
4612 | { | ||
4613 | m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); | ||
4614 | |||
4615 | Velocity = Vector3.Zero; | ||
4616 | AbsolutePosition = EnforceSanityOnPosition(origPosition); | ||
4617 | |||
4618 | AddToPhysicalScene(isFlying); | ||
4619 | } | ||
4620 | } | ||
4621 | } | ||
4622 | |||
4623 | // Given a position, make sure it is within the current region. | ||
4624 | // If just outside some border, the returned position will be just inside the border on that side. | ||
4625 | private Vector3 EnforceSanityOnPosition(Vector3 origPosition) | ||
4626 | { | ||
4627 | const float borderFudge = 0.1f; | ||
4628 | Vector3 ret = origPosition; | ||
4629 | |||
4630 | // Sanity checking on the position to make sure it is in the region we couldn't cross from | ||
4631 | float extentX = (float)m_scene.RegionInfo.RegionSizeX; | ||
4632 | float extentY = (float)m_scene.RegionInfo.RegionSizeY; | ||
4633 | IRegionCombinerModule combiner = m_scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
4634 | if (combiner != null) | ||
4635 | { | ||
4636 | // If a mega-region, the size could be much bigger | ||
4637 | Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | ||
4638 | extentX = megaExtent.X; | ||
4639 | extentY = megaExtent.Y; | ||
4640 | } | ||
4641 | if (ret.X < 0) | ||
4642 | ret.X = borderFudge; | ||
4643 | else if (ret.X >= extentX) | ||
4644 | ret.X = extentX - borderFudge; | ||
4645 | if (ret.Y < 0) | ||
4646 | ret.Y = borderFudge; | ||
4647 | else if (ret.Y >= extentY) | ||
4648 | ret.Y = extentY - borderFudge; | ||
4649 | |||
4650 | return ret; | ||
4651 | ======= | ||
3888 | Vector3 pos2 = AbsolutePosition; | 4652 | Vector3 pos2 = AbsolutePosition; |
3889 | Vector3 vel = Velocity; | 4653 | Vector3 vel = Velocity; |
3890 | 4654 | ||
@@ -3947,6 +4711,7 @@ no information to check this | |||
3947 | AddToPhysicalScene(isFlying); | 4711 | AddToPhysicalScene(isFlying); |
3948 | } | 4712 | } |
3949 | 4713 | ||
4714 | >>>>>>> avn/ubitvar | ||
3950 | } | 4715 | } |
3951 | 4716 | ||
3952 | /// <summary> | 4717 | /// <summary> |
@@ -4014,6 +4779,16 @@ no information to check this | |||
4014 | // Don't close the agent on this region yet | 4779 | // Don't close the agent on this region yet |
4015 | if (handle != Scene.RegionInfo.RegionHandle) | 4780 | if (handle != Scene.RegionInfo.RegionHandle) |
4016 | { | 4781 | { |
4782 | <<<<<<< HEAD | ||
4783 | uint x, y; | ||
4784 | Util.RegionHandleToRegionLoc(handle, out x, out y); | ||
4785 | |||
4786 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
4787 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
4788 | float dist = (float)Math.Max(Scene.DefaultDrawDistance, | ||
4789 | (float)Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); | ||
4790 | if (Util.IsOutsideView(dist, x, newRegionX, y, newRegionY)) | ||
4791 | ======= | ||
4017 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 4792 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
4018 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) | 4793 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) |
4019 | { | 4794 | { |
@@ -4027,6 +4802,7 @@ no information to check this | |||
4027 | } | 4802 | } |
4028 | } | 4803 | } |
4029 | else | 4804 | else |
4805 | >>>>>>> avn/ubitvar | ||
4030 | { | 4806 | { |
4031 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, | 4807 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, |
4032 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | 4808 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) |
@@ -4099,6 +4875,8 @@ no information to check this | |||
4099 | return; | 4875 | return; |
4100 | 4876 | ||
4101 | CopyFrom(cAgentData); | 4877 | CopyFrom(cAgentData); |
4878 | |||
4879 | m_updateAgentReceivedAfterTransferEvent.Set(); | ||
4102 | } | 4880 | } |
4103 | 4881 | ||
4104 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); | 4882 | private static Vector3 marker = new Vector3(-1f, -1f, -1f); |
@@ -4117,11 +4895,23 @@ no information to check this | |||
4117 | if (!IsChildAgent) | 4895 | if (!IsChildAgent) |
4118 | return; | 4896 | return; |
4119 | 4897 | ||
4898 | <<<<<<< HEAD | ||
4899 | // m_log.DebugFormat( | ||
4900 | // "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}", | ||
4901 | // Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position); | ||
4902 | |||
4903 | // Find the distance (in meters) between the two regions | ||
4904 | // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the | ||
4905 | // uint | ||
4906 | int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize); | ||
4907 | int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize); | ||
4908 | ======= | ||
4120 | RegionHandle = cAgentData.RegionHandle; | 4909 | RegionHandle = cAgentData.RegionHandle; |
4121 | 4910 | ||
4122 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); | 4911 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); |
4123 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; | 4912 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; |
4124 | int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; | 4913 | int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; |
4914 | >>>>>>> avn/ubitvar | ||
4125 | 4915 | ||
4126 | Vector3 offset = new Vector3(shiftx, shifty, 0f); | 4916 | Vector3 offset = new Vector3(shiftx, shifty, 0f); |
4127 | 4917 | ||
@@ -4129,7 +4919,11 @@ no information to check this | |||
4129 | // changes, then start using the agent's drawdistance rather than the | 4919 | // changes, then start using the agent's drawdistance rather than the |
4130 | // region's draw distance. | 4920 | // region's draw distance. |
4131 | DrawDistance = cAgentData.Far; | 4921 | DrawDistance = cAgentData.Far; |
4922 | <<<<<<< HEAD | ||
4923 | // DrawDistance = Scene.DefaultDrawDistance; | ||
4924 | ======= | ||
4132 | // DrawDistance = Scene.DefaultDrawDistance; | 4925 | // DrawDistance = Scene.DefaultDrawDistance; |
4926 | >>>>>>> avn/ubitvar | ||
4133 | 4927 | ||
4134 | if (cAgentData.Position != marker) // UGH!! | 4928 | if (cAgentData.Position != marker) // UGH!! |
4135 | m_pos = cAgentData.Position + offset; | 4929 | m_pos = cAgentData.Position + offset; |
@@ -4244,7 +5038,10 @@ no information to check this | |||
4244 | 5038 | ||
4245 | private void CopyFrom(AgentData cAgent) | 5039 | private void CopyFrom(AgentData cAgent) |
4246 | { | 5040 | { |
5041 | <<<<<<< HEAD | ||
5042 | ======= | ||
4247 | 5043 | ||
5044 | >>>>>>> avn/ubitvar | ||
4248 | m_callbackURI = cAgent.CallbackURI; | 5045 | m_callbackURI = cAgent.CallbackURI; |
4249 | // m_log.DebugFormat( | 5046 | // m_log.DebugFormat( |
4250 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", | 5047 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", |
@@ -4263,6 +5060,9 @@ no information to check this | |||
4263 | // changes, then start using the agent's drawdistance rather than the | 5060 | // changes, then start using the agent's drawdistance rather than the |
4264 | // region's draw distance. | 5061 | // region's draw distance. |
4265 | DrawDistance = cAgent.Far; | 5062 | DrawDistance = cAgent.Far; |
5063 | <<<<<<< HEAD | ||
5064 | // DrawDistance = Scene.DefaultDrawDistance; | ||
5065 | ======= | ||
4266 | //DrawDistance = Scene.DefaultDrawDistance; | 5066 | //DrawDistance = Scene.DefaultDrawDistance; |
4267 | 5067 | ||
4268 | if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) | 5068 | if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) |
@@ -4273,6 +5073,7 @@ no information to check this | |||
4273 | } | 5073 | } |
4274 | KnownRegions = cAgent.ChildrenCapSeeds; | 5074 | KnownRegions = cAgent.ChildrenCapSeeds; |
4275 | } | 5075 | } |
5076 | >>>>>>> avn/ubitvar | ||
4276 | 5077 | ||
4277 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) | 5078 | if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) |
4278 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); | 5079 | ControllingClient.SetChildAgentThrottle(cAgent.Throttles); |
@@ -4334,11 +5135,35 @@ no information to check this | |||
4334 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; | 5135 | Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; |
4335 | 5136 | ||
4336 | if (Scene.AttachmentsModule != null) | 5137 | if (Scene.AttachmentsModule != null) |
5138 | <<<<<<< HEAD | ||
5139 | { | ||
5140 | // If the JobEngine is running we can schedule this job now and continue rather than waiting for all | ||
5141 | // attachments to copy, which might take a long time in the Hypergrid case as the entire inventory | ||
5142 | // graph is inspected for each attachments and assets possibly fetched. | ||
5143 | // | ||
5144 | // We don't need to worry about a race condition as the job to later start the scripts is also | ||
5145 | // JobEngine scheduled and so will always occur after this task. | ||
5146 | // XXX: This will not be true if JobEngine ever gets more than one thread. | ||
5147 | WorkManager.RunJob( | ||
5148 | "CopyAttachments", | ||
5149 | o => Scene.AttachmentsModule.CopyAttachments(cAgent, this), | ||
5150 | null, | ||
5151 | string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name), | ||
5152 | true); | ||
5153 | } | ||
5154 | |||
5155 | // This must occur after attachments are copied or scheduled to be copied, as it releases the CompleteMovement() calling thread | ||
5156 | // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart | ||
5157 | // script attachments can outrace this thread. | ||
5158 | lock (m_originRegionIDAccessLock) | ||
5159 | m_originRegionID = cAgent.RegionID; | ||
5160 | ======= | ||
4337 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 5161 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
4338 | 5162 | ||
4339 | lock (m_originRegionIDAccessLock) | 5163 | lock (m_originRegionIDAccessLock) |
4340 | m_originRegionID = cAgent.RegionID; | 5164 | m_originRegionID = cAgent.RegionID; |
4341 | 5165 | ||
5166 | >>>>>>> avn/ubitvar | ||
4342 | } | 5167 | } |
4343 | 5168 | ||
4344 | public bool CopyAgent(out IAgentData agent) | 5169 | public bool CopyAgent(out IAgentData agent) |
@@ -4387,20 +5212,22 @@ no information to check this | |||
4387 | if (Appearance.AvatarHeight == 0) | 5212 | if (Appearance.AvatarHeight == 0) |
4388 | // Appearance.SetHeight(); | 5213 | // Appearance.SetHeight(); |
4389 | Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); | 5214 | Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); |
4390 | 5215 | ||
4391 | PhysicsScene scene = m_scene.PhysicsScene; | ||
4392 | |||
4393 | Vector3 pVec = AbsolutePosition; | ||
4394 | |||
4395 | /* | 5216 | /* |
4396 | PhysicsActor = scene.AddAvatar( | 5217 | PhysicsActor = scene.AddAvatar( |
4397 | LocalId, Firstname + "." + Lastname, pVec, | 5218 | LocalId, Firstname + "." + Lastname, pVec, |
4398 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); | 5219 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); |
4399 | */ | 5220 | */ |
4400 | 5221 | ||
5222 | <<<<<<< HEAD | ||
5223 | PhysicsActor = m_scene.PhysicsScene.AddAvatar( | ||
5224 | LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity, | ||
5225 | Appearance.AvatarBoxSize, isFlying); | ||
5226 | ======= | ||
4401 | PhysicsActor = scene.AddAvatar( | 5227 | PhysicsActor = scene.AddAvatar( |
4402 | LocalId, Firstname + "." + Lastname, pVec, | 5228 | LocalId, Firstname + "." + Lastname, pVec, |
4403 | Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); | 5229 | Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); |
5230 | >>>>>>> avn/ubitvar | ||
4404 | 5231 | ||
4405 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 5232 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
4406 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 5233 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
@@ -5099,7 +5926,7 @@ no information to check this | |||
5099 | } | 5926 | } |
5100 | } | 5927 | } |
5101 | } | 5928 | } |
5102 | }); | 5929 | }, null, "ScenePresence.SendScriptEventToAttachments"); |
5103 | } | 5930 | } |
5104 | 5931 | ||
5105 | /// <summary> | 5932 | /// <summary> |
@@ -5536,6 +6363,7 @@ no information to check this | |||
5536 | } | 6363 | } |
5537 | } | 6364 | } |
5538 | 6365 | ||
6366 | // Modify landing point based on possible banning, telehubs or parcel restrictions. | ||
5539 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) | 6367 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) |
5540 | { | 6368 | { |
5541 | string reason; | 6369 | string reason; |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 5cb271d..998789d 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -119,21 +119,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
119 | return output; | 119 | return output; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) | 123 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) |
124 | { | 124 | { |
125 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); | 125 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); |
126 | 126 | ||
127 | coa = null; | 127 | coa = null; |
128 | int i = 0; | ||
129 | 128 | ||
130 | using (StringReader sr = new StringReader(xml)) | 129 | try |
131 | { | 130 | { |
132 | using (XmlTextReader reader = new XmlTextReader(sr)) | 131 | // Quickly check if this is a coalesced object, without fully parsing the XML |
133 | { | 132 | using (StringReader sr = new StringReader(xml)) |
134 | try | 133 | { |
134 | using (XmlTextReader reader = new XmlTextReader(sr)) | ||
135 | { | 135 | { |
136 | reader.Read(); | 136 | reader.MoveToContent(); // skip possible xml declaration |
137 | |||
137 | if (reader.Name != "CoalescedObject") | 138 | if (reader.Name != "CoalescedObject") |
138 | { | 139 | { |
139 | // m_log.DebugFormat( | 140 | // m_log.DebugFormat( |
@@ -142,49 +143,47 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
142 | 143 | ||
143 | return false; | 144 | return false; |
144 | } | 145 | } |
145 | 146 | } | |
146 | coa = new CoalescedSceneObjects(UUID.Zero); | 147 | } |
147 | reader.Read(); | ||
148 | |||
149 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") | ||
150 | { | ||
151 | if (reader.Name == "SceneObjectGroup") | ||
152 | { | ||
153 | string soXml = reader.ReadOuterXml(); | ||
154 | |||
155 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml); | ||
156 | |||
157 | if (so != null) | ||
158 | { | ||
159 | coa.Add(so); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | // XXX: Possibly we should fail outright here rather than continuing if a particular component of the | ||
164 | // coalesced object fails to load. | ||
165 | m_log.WarnFormat( | ||
166 | "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", | ||
167 | i); | ||
168 | } | ||
169 | 148 | ||
170 | i++; | 149 | XmlDocument doc = new XmlDocument(); |
171 | } | 150 | doc.LoadXml(xml); |
172 | } | 151 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); |
152 | if (e == null) | ||
153 | return false; | ||
173 | 154 | ||
174 | reader.ReadEndElement(); // CoalescedObject | 155 | coa = new CoalescedSceneObjects(UUID.Zero); |
156 | |||
157 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
158 | int i = 0; | ||
159 | |||
160 | foreach (XmlNode n in groups) | ||
161 | { | ||
162 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | ||
163 | if (so != null) | ||
164 | { | ||
165 | coa.Add(so); | ||
175 | } | 166 | } |
176 | catch (Exception e) | 167 | else |
177 | { | 168 | { |
178 | m_log.ErrorFormat( | 169 | // XXX: Possibly we should fail outright here rather than continuing if a particular component of the |
179 | "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}", | 170 | // coalesced object fails to load. |
180 | e.Message, e.StackTrace); | 171 | m_log.WarnFormat( |
181 | 172 | "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", | |
182 | return false; | 173 | i); |
183 | } | 174 | } |
175 | |||
176 | i++; | ||
184 | } | 177 | } |
185 | } | 178 | } |
179 | catch (Exception e) | ||
180 | { | ||
181 | m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); | ||
182 | Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); | ||
183 | return false; | ||
184 | } | ||
186 | 185 | ||
187 | return true; | 186 | return true; |
188 | } | 187 | } |
189 | } | 188 | } |
190 | } \ No newline at end of file | 189 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3d14943..dc5de58 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -38,6 +38,7 @@ using OpenSim.Framework; | |||
38 | using OpenSim.Framework.Serialization.External; | 38 | using OpenSim.Framework.Serialization.External; |
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | ||
41 | 42 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Serialization | 43 | namespace OpenSim.Region.Framework.Scenes.Serialization |
43 | { | 44 | { |
@@ -51,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 53 | ||
53 | private static IUserManagement m_UserManagement; | 54 | private static IUserManagement m_UserManagement; |
54 | 55 | ||
55 | /// <summary> | 56 | /// <summary> |
56 | /// Deserialize a scene object from the original xml format | 57 | /// Deserialize a scene object from the original xml format |
57 | /// </summary> | 58 | /// </summary> |
@@ -59,57 +60,62 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
59 | /// <returns>The scene object deserialized. Null on failure.</returns> | 60 | /// <returns>The scene object deserialized. Null on failure.</returns> |
60 | public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) | 61 | public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) |
61 | { | 62 | { |
62 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); |
63 | //int time = System.Environment.TickCount; | 64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) |
64 | |||
65 | try | ||
66 | { | 65 | { |
67 | StringReader sr; | 66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) |
68 | XmlTextReader reader; | 67 | { |
69 | XmlNodeList parts; | 68 | try { |
70 | XmlDocument doc; | 69 | return FromOriginalXmlFormat(reader); |
71 | int linkNum; | 70 | } |
72 | 71 | catch (Exception e) | |
73 | doc = new XmlDocument(); | 72 | { |
74 | doc.LoadXml(xmlData); | 73 | m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); |
75 | parts = doc.GetElementsByTagName("RootPart"); | 74 | Util.LogFailedXML("[SERIALIZER]:", fixedData); |
75 | return null; | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | } | ||
76 | 80 | ||
77 | if (parts.Count == 0) | 81 | /// <summary> |
78 | throw new Exception("Invalid Xml format - no root part"); | 82 | /// Deserialize a scene object from the original xml format |
83 | /// </summary> | ||
84 | /// <param name="xmlData"></param> | ||
85 | /// <returns>The scene object deserialized. Null on failure.</returns> | ||
86 | public static SceneObjectGroup FromOriginalXmlFormat(XmlReader reader) | ||
87 | { | ||
88 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | ||
89 | //int time = System.Environment.TickCount; | ||
79 | 90 | ||
80 | sr = new StringReader(parts[0].InnerXml); | 91 | int linkNum; |
81 | reader = new XmlTextReader(sr); | ||
82 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | ||
83 | reader.Close(); | ||
84 | sr.Close(); | ||
85 | 92 | ||
86 | parts = doc.GetElementsByTagName("Part"); | 93 | reader.ReadToFollowing("RootPart"); |
94 | reader.ReadToFollowing("SceneObjectPart"); | ||
95 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | ||
96 | reader.ReadToFollowing("OtherParts"); | ||
87 | 97 | ||
88 | for (int i = 0; i < parts.Count; i++) | 98 | if (reader.ReadToDescendant("Part")) |
99 | { | ||
100 | do | ||
89 | { | 101 | { |
90 | sr = new StringReader(parts[i].InnerXml); | 102 | if (reader.ReadToDescendant("SceneObjectPart")) |
91 | reader = new XmlTextReader(sr); | 103 | { |
92 | SceneObjectPart part = SceneObjectPart.FromXml(reader); | 104 | SceneObjectPart part = SceneObjectPart.FromXml(reader); |
93 | linkNum = part.LinkNum; | 105 | linkNum = part.LinkNum; |
94 | sceneObject.AddPart(part); | 106 | sceneObject.AddPart(part); |
95 | part.LinkNum = linkNum; | 107 | part.LinkNum = linkNum; |
96 | part.TrimPermissions(); | 108 | part.TrimPermissions(); |
97 | reader.Close(); | 109 | } |
98 | sr.Close(); | 110 | } |
99 | } | 111 | while (reader.ReadToNextSibling("Part")); |
112 | } | ||
100 | 113 | ||
101 | // Script state may, or may not, exist. Not having any, is NOT | 114 | // Script state may, or may not, exist. Not having any, is NOT |
102 | // ever a problem. | 115 | // ever a problem. |
103 | sceneObject.LoadScriptState(doc); | 116 | sceneObject.LoadScriptState(reader); |
104 | 117 | ||
105 | return sceneObject; | 118 | return sceneObject; |
106 | } | ||
107 | catch (Exception e) | ||
108 | { | ||
109 | m_log.ErrorFormat( | ||
110 | "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); | ||
111 | return null; | ||
112 | } | ||
113 | } | 119 | } |
114 | 120 | ||
115 | /// <summary> | 121 | /// <summary> |
@@ -232,7 +238,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
232 | 238 | ||
233 | if (parts.Count == 0) | 239 | if (parts.Count == 0) |
234 | { | 240 | { |
235 | m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); | 241 | m_log.Error("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes"); |
242 | Util.LogFailedXML("[SERIALIZER]:", xmlData); | ||
236 | return null; | 243 | return null; |
237 | } | 244 | } |
238 | 245 | ||
@@ -276,7 +283,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
276 | } | 283 | } |
277 | catch (Exception e) | 284 | catch (Exception e) |
278 | { | 285 | { |
279 | m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); | 286 | m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); |
287 | Util.LogFailedXML("[SERIALIZER]:", xmlData); | ||
280 | return null; | 288 | return null; |
281 | } | 289 | } |
282 | } | 290 | } |
@@ -299,13 +307,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
299 | } | 307 | } |
300 | } | 308 | } |
301 | 309 | ||
310 | <<<<<<< HEAD | ||
311 | |||
312 | ======= | ||
313 | >>>>>>> avn/ubitvar | ||
302 | /// <summary> | 314 | /// <summary> |
303 | /// Modifies a SceneObjectGroup. | 315 | /// Modifies a SceneObjectGroup. |
304 | /// </summary> | 316 | /// </summary> |
305 | /// <param name="sog">The object</param> | 317 | /// <param name="sog">The object</param> |
306 | /// <returns>Whether the object was actually modified</returns> | 318 | /// <returns>Whether the object was actually modified</returns> |
307 | public delegate bool SceneObjectModifier(SceneObjectGroup sog); | 319 | public delegate bool SceneObjectModifier(SceneObjectGroup sog); |
320 | <<<<<<< HEAD | ||
321 | |||
322 | ======= | ||
308 | 323 | ||
324 | >>>>>>> avn/ubitvar | ||
309 | /// <summary> | 325 | /// <summary> |
310 | /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. | 326 | /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. |
311 | /// </summary> | 327 | /// </summary> |
@@ -319,7 +335,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
319 | CoalescedSceneObjects coa = null; | 335 | CoalescedSceneObjects coa = null; |
320 | 336 | ||
321 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); | 337 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); |
338 | <<<<<<< HEAD | ||
339 | |||
340 | ======= | ||
322 | 341 | ||
342 | >>>>>>> avn/ubitvar | ||
323 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 343 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) |
324 | { | 344 | { |
325 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | 345 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); |
@@ -364,17 +384,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
364 | 384 | ||
365 | return data; | 385 | return data; |
366 | } | 386 | } |
387 | <<<<<<< HEAD | ||
388 | |||
389 | ======= | ||
390 | >>>>>>> avn/ubitvar | ||
367 | 391 | ||
368 | #region manual serialization | 392 | #region manual serialization |
369 | 393 | ||
370 | private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors | 394 | private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors |
371 | = new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>(); | 395 | = new Dictionary<string, Action<SceneObjectPart, XmlReader>>(); |
372 | 396 | ||
373 | private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors | 397 | private static Dictionary<string, Action<TaskInventoryItem, XmlReader>> m_TaskInventoryXmlProcessors |
374 | = new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>(); | 398 | = new Dictionary<string, Action<TaskInventoryItem, XmlReader>>(); |
375 | 399 | ||
376 | private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors | 400 | private static Dictionary<string, Action<PrimitiveBaseShape, XmlReader>> m_ShapeXmlProcessors |
377 | = new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>(); | 401 | = new Dictionary<string, Action<PrimitiveBaseShape, XmlReader>>(); |
378 | 402 | ||
379 | static SceneObjectSerializer() | 403 | static SceneObjectSerializer() |
380 | { | 404 | { |
@@ -521,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
521 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); | 545 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); |
522 | m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); | 546 | m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); |
523 | m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); | 547 | m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); |
524 | m_ShapeXmlProcessors.Add("SculptData", ProcessShpSculptData); | 548 | // Ignore "SculptData"; this element is deprecated |
525 | m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); | 549 | m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); |
526 | m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); | 550 | m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); |
527 | m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); | 551 | m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); |
@@ -546,112 +570,112 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
546 | } | 570 | } |
547 | 571 | ||
548 | #region SOPXmlProcessors | 572 | #region SOPXmlProcessors |
549 | private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) | 573 | private static void ProcessAllowedDrop(SceneObjectPart obj, XmlReader reader) |
550 | { | 574 | { |
551 | obj.AllowedDrop = Util.ReadBoolean(reader); | 575 | obj.AllowedDrop = Util.ReadBoolean(reader); |
552 | } | 576 | } |
553 | 577 | ||
554 | private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) | 578 | private static void ProcessCreatorID(SceneObjectPart obj, XmlReader reader) |
555 | { | 579 | { |
556 | obj.CreatorID = Util.ReadUUID(reader, "CreatorID"); | 580 | obj.CreatorID = Util.ReadUUID(reader, "CreatorID"); |
557 | } | 581 | } |
558 | 582 | ||
559 | private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) | 583 | private static void ProcessCreatorData(SceneObjectPart obj, XmlReader reader) |
560 | { | 584 | { |
561 | obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | 585 | obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); |
562 | } | 586 | } |
563 | 587 | ||
564 | private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) | 588 | private static void ProcessFolderID(SceneObjectPart obj, XmlReader reader) |
565 | { | 589 | { |
566 | obj.FolderID = Util.ReadUUID(reader, "FolderID"); | 590 | obj.FolderID = Util.ReadUUID(reader, "FolderID"); |
567 | } | 591 | } |
568 | 592 | ||
569 | private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) | 593 | private static void ProcessInventorySerial(SceneObjectPart obj, XmlReader reader) |
570 | { | 594 | { |
571 | obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); | 595 | obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); |
572 | } | 596 | } |
573 | 597 | ||
574 | private static void ProcessTaskInventory(SceneObjectPart obj, XmlTextReader reader) | 598 | private static void ProcessTaskInventory(SceneObjectPart obj, XmlReader reader) |
575 | { | 599 | { |
576 | obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); | 600 | obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); |
577 | } | 601 | } |
578 | 602 | ||
579 | private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) | 603 | private static void ProcessUUID(SceneObjectPart obj, XmlReader reader) |
580 | { | 604 | { |
581 | obj.UUID = Util.ReadUUID(reader, "UUID"); | 605 | obj.UUID = Util.ReadUUID(reader, "UUID"); |
582 | } | 606 | } |
583 | 607 | ||
584 | private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) | 608 | private static void ProcessLocalId(SceneObjectPart obj, XmlReader reader) |
585 | { | 609 | { |
586 | obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); | 610 | obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); |
587 | } | 611 | } |
588 | 612 | ||
589 | private static void ProcessName(SceneObjectPart obj, XmlTextReader reader) | 613 | private static void ProcessName(SceneObjectPart obj, XmlReader reader) |
590 | { | 614 | { |
591 | obj.Name = reader.ReadElementString("Name"); | 615 | obj.Name = reader.ReadElementString("Name"); |
592 | } | 616 | } |
593 | 617 | ||
594 | private static void ProcessMaterial(SceneObjectPart obj, XmlTextReader reader) | 618 | private static void ProcessMaterial(SceneObjectPart obj, XmlReader reader) |
595 | { | 619 | { |
596 | obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); | 620 | obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); |
597 | } | 621 | } |
598 | 622 | ||
599 | private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) | 623 | private static void ProcessPassTouches(SceneObjectPart obj, XmlReader reader) |
600 | { | 624 | { |
601 | obj.PassTouches = Util.ReadBoolean(reader); | 625 | obj.PassTouches = Util.ReadBoolean(reader); |
602 | } | 626 | } |
603 | 627 | ||
604 | private static void ProcessPassCollisions(SceneObjectPart obj, XmlTextReader reader) | 628 | private static void ProcessPassCollisions(SceneObjectPart obj, XmlReader reader) |
605 | { | 629 | { |
606 | obj.PassCollisions = Util.ReadBoolean(reader); | 630 | obj.PassCollisions = Util.ReadBoolean(reader); |
607 | } | 631 | } |
608 | 632 | ||
609 | private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) | 633 | private static void ProcessRegionHandle(SceneObjectPart obj, XmlReader reader) |
610 | { | 634 | { |
611 | obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); | 635 | obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); |
612 | } | 636 | } |
613 | 637 | ||
614 | private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlTextReader reader) | 638 | private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlReader reader) |
615 | { | 639 | { |
616 | obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); | 640 | obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); |
617 | } | 641 | } |
618 | 642 | ||
619 | private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) | 643 | private static void ProcessGroupPosition(SceneObjectPart obj, XmlReader reader) |
620 | { | 644 | { |
621 | obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); | 645 | obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); |
622 | } | 646 | } |
623 | 647 | ||
624 | private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) | 648 | private static void ProcessOffsetPosition(SceneObjectPart obj, XmlReader reader) |
625 | { | 649 | { |
626 | obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; | 650 | obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; |
627 | } | 651 | } |
628 | 652 | ||
629 | private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) | 653 | private static void ProcessRotationOffset(SceneObjectPart obj, XmlReader reader) |
630 | { | 654 | { |
631 | obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); | 655 | obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); |
632 | } | 656 | } |
633 | 657 | ||
634 | private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) | 658 | private static void ProcessVelocity(SceneObjectPart obj, XmlReader reader) |
635 | { | 659 | { |
636 | obj.Velocity = Util.ReadVector(reader, "Velocity"); | 660 | obj.Velocity = Util.ReadVector(reader, "Velocity"); |
637 | } | 661 | } |
638 | 662 | ||
639 | private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) | 663 | private static void ProcessAngularVelocity(SceneObjectPart obj, XmlReader reader) |
640 | { | 664 | { |
641 | obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); | 665 | obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); |
642 | } | 666 | } |
643 | 667 | ||
644 | private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) | 668 | private static void ProcessAcceleration(SceneObjectPart obj, XmlReader reader) |
645 | { | 669 | { |
646 | obj.Acceleration = Util.ReadVector(reader, "Acceleration"); | 670 | obj.Acceleration = Util.ReadVector(reader, "Acceleration"); |
647 | } | 671 | } |
648 | 672 | ||
649 | private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) | 673 | private static void ProcessDescription(SceneObjectPart obj, XmlReader reader) |
650 | { | 674 | { |
651 | obj.Description = reader.ReadElementString("Description"); | 675 | obj.Description = reader.ReadElementString("Description"); |
652 | } | 676 | } |
653 | 677 | ||
654 | private static void ProcessColor(SceneObjectPart obj, XmlTextReader reader) | 678 | private static void ProcessColor(SceneObjectPart obj, XmlReader reader) |
655 | { | 679 | { |
656 | reader.ReadStartElement("Color"); | 680 | reader.ReadStartElement("Color"); |
657 | if (reader.Name == "R") | 681 | if (reader.Name == "R") |
@@ -665,56 +689,59 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
665 | } | 689 | } |
666 | } | 690 | } |
667 | 691 | ||
668 | private static void ProcessText(SceneObjectPart obj, XmlTextReader reader) | 692 | private static void ProcessText(SceneObjectPart obj, XmlReader reader) |
669 | { | 693 | { |
670 | obj.Text = reader.ReadElementString("Text", String.Empty); | 694 | obj.Text = reader.ReadElementString("Text", String.Empty); |
671 | } | 695 | } |
672 | 696 | ||
673 | private static void ProcessSitName(SceneObjectPart obj, XmlTextReader reader) | 697 | private static void ProcessSitName(SceneObjectPart obj, XmlReader reader) |
674 | { | 698 | { |
675 | obj.SitName = reader.ReadElementString("SitName", String.Empty); | 699 | obj.SitName = reader.ReadElementString("SitName", String.Empty); |
676 | } | 700 | } |
677 | 701 | ||
678 | private static void ProcessTouchName(SceneObjectPart obj, XmlTextReader reader) | 702 | private static void ProcessTouchName(SceneObjectPart obj, XmlReader reader) |
679 | { | 703 | { |
680 | obj.TouchName = reader.ReadElementString("TouchName", String.Empty); | 704 | obj.TouchName = reader.ReadElementString("TouchName", String.Empty); |
681 | } | 705 | } |
682 | 706 | ||
683 | private static void ProcessLinkNum(SceneObjectPart obj, XmlTextReader reader) | 707 | private static void ProcessLinkNum(SceneObjectPart obj, XmlReader reader) |
684 | { | 708 | { |
685 | obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); | 709 | obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); |
686 | } | 710 | } |
687 | 711 | ||
688 | private static void ProcessClickAction(SceneObjectPart obj, XmlTextReader reader) | 712 | private static void ProcessClickAction(SceneObjectPart obj, XmlReader reader) |
689 | { | 713 | { |
690 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); | 714 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); |
691 | } | 715 | } |
692 | 716 | ||
693 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader) | 717 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader) |
694 | { | 718 | { |
695 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); | 719 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); |
696 | } | 720 | } |
697 | 721 | ||
698 | private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) | 722 | private static void ProcessDensity(SceneObjectPart obj, XmlReader reader) |
699 | { | 723 | { |
700 | obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); | 724 | obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); |
701 | } | 725 | } |
702 | 726 | ||
703 | private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) | 727 | private static void ProcessFriction(SceneObjectPart obj, XmlReader reader) |
704 | { | 728 | { |
705 | obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); | 729 | obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); |
706 | } | 730 | } |
707 | 731 | ||
708 | private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) | 732 | private static void ProcessBounce(SceneObjectPart obj, XmlReader reader) |
709 | { | 733 | { |
710 | obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty); | 734 | obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty); |
711 | } | 735 | } |
712 | 736 | ||
713 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) | 737 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlReader reader) |
714 | { | 738 | { |
715 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | 739 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
716 | } | 740 | } |
717 | 741 | ||
742 | <<<<<<< HEAD | ||
743 | private static void ProcessShape(SceneObjectPart obj, XmlReader reader) | ||
744 | ======= | ||
718 | private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) | 745 | private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) |
719 | { | 746 | { |
720 | obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); | 747 | obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); |
@@ -767,9 +794,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
767 | } | 794 | } |
768 | 795 | ||
769 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 796 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
797 | >>>>>>> avn/ubitvar | ||
770 | { | 798 | { |
771 | List<string> errorNodeNames; | 799 | List<string> errorNodeNames; |
772 | obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); | 800 | obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj); |
773 | 801 | ||
774 | if (errorNodeNames != null) | 802 | if (errorNodeNames != null) |
775 | { | 803 | { |
@@ -779,163 +807,163 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
779 | } | 807 | } |
780 | } | 808 | } |
781 | 809 | ||
782 | private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) | 810 | private static void ProcessScale(SceneObjectPart obj, XmlReader reader) |
783 | { | 811 | { |
784 | obj.Scale = Util.ReadVector(reader, "Scale"); | 812 | obj.Scale = Util.ReadVector(reader, "Scale"); |
785 | } | 813 | } |
786 | 814 | ||
787 | private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) | 815 | private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlReader reader) |
788 | { | 816 | { |
789 | obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation"); | 817 | obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation"); |
790 | } | 818 | } |
791 | 819 | ||
792 | private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) | 820 | private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlReader reader) |
793 | { | 821 | { |
794 | obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition"); | 822 | obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition"); |
795 | } | 823 | } |
796 | 824 | ||
797 | private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) | 825 | private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlReader reader) |
798 | { | 826 | { |
799 | obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL"); | 827 | obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL"); |
800 | } | 828 | } |
801 | 829 | ||
802 | private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) | 830 | private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlReader reader) |
803 | { | 831 | { |
804 | obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL"); | 832 | obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL"); |
805 | } | 833 | } |
806 | 834 | ||
807 | private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) | 835 | private static void ProcessParentID(SceneObjectPart obj, XmlReader reader) |
808 | { | 836 | { |
809 | string str = reader.ReadElementContentAsString("ParentID", String.Empty); | 837 | string str = reader.ReadElementContentAsString("ParentID", String.Empty); |
810 | obj.ParentID = Convert.ToUInt32(str); | 838 | obj.ParentID = Convert.ToUInt32(str); |
811 | } | 839 | } |
812 | 840 | ||
813 | private static void ProcessCreationDate(SceneObjectPart obj, XmlTextReader reader) | 841 | private static void ProcessCreationDate(SceneObjectPart obj, XmlReader reader) |
814 | { | 842 | { |
815 | obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); | 843 | obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); |
816 | } | 844 | } |
817 | 845 | ||
818 | private static void ProcessCategory(SceneObjectPart obj, XmlTextReader reader) | 846 | private static void ProcessCategory(SceneObjectPart obj, XmlReader reader) |
819 | { | 847 | { |
820 | obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty); | 848 | obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty); |
821 | } | 849 | } |
822 | 850 | ||
823 | private static void ProcessSalePrice(SceneObjectPart obj, XmlTextReader reader) | 851 | private static void ProcessSalePrice(SceneObjectPart obj, XmlReader reader) |
824 | { | 852 | { |
825 | obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); | 853 | obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); |
826 | } | 854 | } |
827 | 855 | ||
828 | private static void ProcessObjectSaleType(SceneObjectPart obj, XmlTextReader reader) | 856 | private static void ProcessObjectSaleType(SceneObjectPart obj, XmlReader reader) |
829 | { | 857 | { |
830 | obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); | 858 | obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); |
831 | } | 859 | } |
832 | 860 | ||
833 | private static void ProcessOwnershipCost(SceneObjectPart obj, XmlTextReader reader) | 861 | private static void ProcessOwnershipCost(SceneObjectPart obj, XmlReader reader) |
834 | { | 862 | { |
835 | obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); | 863 | obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); |
836 | } | 864 | } |
837 | 865 | ||
838 | private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) | 866 | private static void ProcessGroupID(SceneObjectPart obj, XmlReader reader) |
839 | { | 867 | { |
840 | obj.GroupID = Util.ReadUUID(reader, "GroupID"); | 868 | obj.GroupID = Util.ReadUUID(reader, "GroupID"); |
841 | } | 869 | } |
842 | 870 | ||
843 | private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) | 871 | private static void ProcessOwnerID(SceneObjectPart obj, XmlReader reader) |
844 | { | 872 | { |
845 | obj.OwnerID = Util.ReadUUID(reader, "OwnerID"); | 873 | obj.OwnerID = Util.ReadUUID(reader, "OwnerID"); |
846 | } | 874 | } |
847 | 875 | ||
848 | private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) | 876 | private static void ProcessLastOwnerID(SceneObjectPart obj, XmlReader reader) |
849 | { | 877 | { |
850 | obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); | 878 | obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); |
851 | } | 879 | } |
852 | 880 | ||
853 | private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) | 881 | private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) |
854 | { | 882 | { |
855 | obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); | 883 | obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); |
856 | } | 884 | } |
857 | 885 | ||
858 | private static void ProcessOwnerMask(SceneObjectPart obj, XmlTextReader reader) | 886 | private static void ProcessOwnerMask(SceneObjectPart obj, XmlReader reader) |
859 | { | 887 | { |
860 | obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); | 888 | obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); |
861 | } | 889 | } |
862 | 890 | ||
863 | private static void ProcessGroupMask(SceneObjectPart obj, XmlTextReader reader) | 891 | private static void ProcessGroupMask(SceneObjectPart obj, XmlReader reader) |
864 | { | 892 | { |
865 | obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); | 893 | obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); |
866 | } | 894 | } |
867 | 895 | ||
868 | private static void ProcessEveryoneMask(SceneObjectPart obj, XmlTextReader reader) | 896 | private static void ProcessEveryoneMask(SceneObjectPart obj, XmlReader reader) |
869 | { | 897 | { |
870 | obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); | 898 | obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); |
871 | } | 899 | } |
872 | 900 | ||
873 | private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlTextReader reader) | 901 | private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlReader reader) |
874 | { | 902 | { |
875 | obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); | 903 | obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); |
876 | } | 904 | } |
877 | 905 | ||
878 | private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) | 906 | private static void ProcessFlags(SceneObjectPart obj, XmlReader reader) |
879 | { | 907 | { |
880 | obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); | 908 | obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); |
881 | } | 909 | } |
882 | 910 | ||
883 | private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) | 911 | private static void ProcessCollisionSound(SceneObjectPart obj, XmlReader reader) |
884 | { | 912 | { |
885 | obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); | 913 | obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); |
886 | } | 914 | } |
887 | 915 | ||
888 | private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) | 916 | private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlReader reader) |
889 | { | 917 | { |
890 | obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); | 918 | obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); |
891 | } | 919 | } |
892 | 920 | ||
893 | private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader) | 921 | private static void ProcessMediaUrl(SceneObjectPart obj, XmlReader reader) |
894 | { | 922 | { |
895 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); | 923 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); |
896 | } | 924 | } |
897 | 925 | ||
898 | private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader) | 926 | private static void ProcessAttachedPos(SceneObjectPart obj, XmlReader reader) |
899 | { | 927 | { |
900 | obj.AttachedPos = Util.ReadVector(reader, "AttachedPos"); | 928 | obj.AttachedPos = Util.ReadVector(reader, "AttachedPos"); |
901 | } | 929 | } |
902 | 930 | ||
903 | private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) | 931 | private static void ProcessDynAttrs(SceneObjectPart obj, XmlReader reader) |
904 | { | 932 | { |
905 | obj.DynAttrs.ReadXml(reader); | 933 | obj.DynAttrs.ReadXml(reader); |
906 | } | 934 | } |
907 | 935 | ||
908 | private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) | 936 | private static void ProcessTextureAnimation(SceneObjectPart obj, XmlReader reader) |
909 | { | 937 | { |
910 | obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); | 938 | obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); |
911 | } | 939 | } |
912 | 940 | ||
913 | private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) | 941 | private static void ProcessParticleSystem(SceneObjectPart obj, XmlReader reader) |
914 | { | 942 | { |
915 | obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); | 943 | obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); |
916 | } | 944 | } |
917 | 945 | ||
918 | private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) | 946 | private static void ProcessPayPrice0(SceneObjectPart obj, XmlReader reader) |
919 | { | 947 | { |
920 | obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); | 948 | obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); |
921 | } | 949 | } |
922 | 950 | ||
923 | private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) | 951 | private static void ProcessPayPrice1(SceneObjectPart obj, XmlReader reader) |
924 | { | 952 | { |
925 | obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); | 953 | obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); |
926 | } | 954 | } |
927 | 955 | ||
928 | private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) | 956 | private static void ProcessPayPrice2(SceneObjectPart obj, XmlReader reader) |
929 | { | 957 | { |
930 | obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); | 958 | obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); |
931 | } | 959 | } |
932 | 960 | ||
933 | private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) | 961 | private static void ProcessPayPrice3(SceneObjectPart obj, XmlReader reader) |
934 | { | 962 | { |
935 | obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); | 963 | obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); |
936 | } | 964 | } |
937 | 965 | ||
938 | private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) | 966 | private static void ProcessPayPrice4(SceneObjectPart obj, XmlReader reader) |
939 | { | 967 | { |
940 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 968 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
941 | } | 969 | } |
@@ -962,122 +990,122 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
962 | #endregion | 990 | #endregion |
963 | 991 | ||
964 | #region TaskInventoryXmlProcessors | 992 | #region TaskInventoryXmlProcessors |
965 | private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) | 993 | private static void ProcessTIAssetID(TaskInventoryItem item, XmlReader reader) |
966 | { | 994 | { |
967 | item.AssetID = Util.ReadUUID(reader, "AssetID"); | 995 | item.AssetID = Util.ReadUUID(reader, "AssetID"); |
968 | } | 996 | } |
969 | 997 | ||
970 | private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) | 998 | private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlReader reader) |
971 | { | 999 | { |
972 | item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); | 1000 | item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); |
973 | } | 1001 | } |
974 | 1002 | ||
975 | private static void ProcessTICreationDate(TaskInventoryItem item, XmlTextReader reader) | 1003 | private static void ProcessTICreationDate(TaskInventoryItem item, XmlReader reader) |
976 | { | 1004 | { |
977 | item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); | 1005 | item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); |
978 | } | 1006 | } |
979 | 1007 | ||
980 | private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) | 1008 | private static void ProcessTICreatorID(TaskInventoryItem item, XmlReader reader) |
981 | { | 1009 | { |
982 | item.CreatorID = Util.ReadUUID(reader, "CreatorID"); | 1010 | item.CreatorID = Util.ReadUUID(reader, "CreatorID"); |
983 | } | 1011 | } |
984 | 1012 | ||
985 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) | 1013 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlReader reader) |
986 | { | 1014 | { |
987 | item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | 1015 | item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); |
988 | } | 1016 | } |
989 | 1017 | ||
990 | private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) | 1018 | private static void ProcessTIDescription(TaskInventoryItem item, XmlReader reader) |
991 | { | 1019 | { |
992 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); | 1020 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); |
993 | } | 1021 | } |
994 | 1022 | ||
995 | private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlTextReader reader) | 1023 | private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlReader reader) |
996 | { | 1024 | { |
997 | item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); | 1025 | item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); |
998 | } | 1026 | } |
999 | 1027 | ||
1000 | private static void ProcessTIFlags(TaskInventoryItem item, XmlTextReader reader) | 1028 | private static void ProcessTIFlags(TaskInventoryItem item, XmlReader reader) |
1001 | { | 1029 | { |
1002 | item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); | 1030 | item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); |
1003 | } | 1031 | } |
1004 | 1032 | ||
1005 | private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) | 1033 | private static void ProcessTIGroupID(TaskInventoryItem item, XmlReader reader) |
1006 | { | 1034 | { |
1007 | item.GroupID = Util.ReadUUID(reader, "GroupID"); | 1035 | item.GroupID = Util.ReadUUID(reader, "GroupID"); |
1008 | } | 1036 | } |
1009 | 1037 | ||
1010 | private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) | 1038 | private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlReader reader) |
1011 | { | 1039 | { |
1012 | item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); | 1040 | item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); |
1013 | } | 1041 | } |
1014 | 1042 | ||
1015 | private static void ProcessTIInvType(TaskInventoryItem item, XmlTextReader reader) | 1043 | private static void ProcessTIInvType(TaskInventoryItem item, XmlReader reader) |
1016 | { | 1044 | { |
1017 | item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); | 1045 | item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); |
1018 | } | 1046 | } |
1019 | 1047 | ||
1020 | private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) | 1048 | private static void ProcessTIItemID(TaskInventoryItem item, XmlReader reader) |
1021 | { | 1049 | { |
1022 | item.ItemID = Util.ReadUUID(reader, "ItemID"); | 1050 | item.ItemID = Util.ReadUUID(reader, "ItemID"); |
1023 | } | 1051 | } |
1024 | 1052 | ||
1025 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) | 1053 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlReader reader) |
1026 | { | 1054 | { |
1027 | item.OldItemID = Util.ReadUUID(reader, "OldItemID"); | 1055 | item.OldItemID = Util.ReadUUID(reader, "OldItemID"); |
1028 | } | 1056 | } |
1029 | 1057 | ||
1030 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) | 1058 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlReader reader) |
1031 | { | 1059 | { |
1032 | item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); | 1060 | item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); |
1033 | } | 1061 | } |
1034 | 1062 | ||
1035 | private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) | 1063 | private static void ProcessTIName(TaskInventoryItem item, XmlReader reader) |
1036 | { | 1064 | { |
1037 | item.Name = reader.ReadElementContentAsString("Name", String.Empty); | 1065 | item.Name = reader.ReadElementContentAsString("Name", String.Empty); |
1038 | } | 1066 | } |
1039 | 1067 | ||
1040 | private static void ProcessTINextPermissions(TaskInventoryItem item, XmlTextReader reader) | 1068 | private static void ProcessTINextPermissions(TaskInventoryItem item, XmlReader reader) |
1041 | { | 1069 | { |
1042 | item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); | 1070 | item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); |
1043 | } | 1071 | } |
1044 | 1072 | ||
1045 | private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) | 1073 | private static void ProcessTIOwnerID(TaskInventoryItem item, XmlReader reader) |
1046 | { | 1074 | { |
1047 | item.OwnerID = Util.ReadUUID(reader, "OwnerID"); | 1075 | item.OwnerID = Util.ReadUUID(reader, "OwnerID"); |
1048 | } | 1076 | } |
1049 | 1077 | ||
1050 | private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) | 1078 | private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlReader reader) |
1051 | { | 1079 | { |
1052 | item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); | 1080 | item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); |
1053 | } | 1081 | } |
1054 | 1082 | ||
1055 | private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) | 1083 | private static void ProcessTIParentID(TaskInventoryItem item, XmlReader reader) |
1056 | { | 1084 | { |
1057 | item.ParentID = Util.ReadUUID(reader, "ParentID"); | 1085 | item.ParentID = Util.ReadUUID(reader, "ParentID"); |
1058 | } | 1086 | } |
1059 | 1087 | ||
1060 | private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) | 1088 | private static void ProcessTIParentPartID(TaskInventoryItem item, XmlReader reader) |
1061 | { | 1089 | { |
1062 | item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); | 1090 | item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); |
1063 | } | 1091 | } |
1064 | 1092 | ||
1065 | private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) | 1093 | private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlReader reader) |
1066 | { | 1094 | { |
1067 | item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); | 1095 | item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); |
1068 | } | 1096 | } |
1069 | 1097 | ||
1070 | private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) | 1098 | private static void ProcessTIPermsMask(TaskInventoryItem item, XmlReader reader) |
1071 | { | 1099 | { |
1072 | item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); | 1100 | item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); |
1073 | } | 1101 | } |
1074 | 1102 | ||
1075 | private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader) | 1103 | private static void ProcessTIType(TaskInventoryItem item, XmlReader reader) |
1076 | { | 1104 | { |
1077 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); | 1105 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); |
1078 | } | 1106 | } |
1079 | 1107 | ||
1080 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) | 1108 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlReader reader) |
1081 | { | 1109 | { |
1082 | item.OwnerChanged = Util.ReadBoolean(reader); | 1110 | item.OwnerChanged = Util.ReadBoolean(reader); |
1083 | } | 1111 | } |
@@ -1085,250 +1113,243 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1085 | #endregion | 1113 | #endregion |
1086 | 1114 | ||
1087 | #region ShapeXmlProcessors | 1115 | #region ShapeXmlProcessors |
1088 | private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlTextReader reader) | 1116 | private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlReader reader) |
1089 | { | 1117 | { |
1090 | shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); | 1118 | shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); |
1091 | } | 1119 | } |
1092 | 1120 | ||
1093 | private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1121 | private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlReader reader) |
1094 | { | 1122 | { |
1095 | byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); | 1123 | byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); |
1096 | shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); | 1124 | shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); |
1097 | } | 1125 | } |
1098 | 1126 | ||
1099 | private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) | 1127 | private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlReader reader) |
1100 | { | 1128 | { |
1101 | shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams")); | 1129 | shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams")); |
1102 | } | 1130 | } |
1103 | 1131 | ||
1104 | private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlTextReader reader) | 1132 | private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlReader reader) |
1105 | { | 1133 | { |
1106 | shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); | 1134 | shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); |
1107 | } | 1135 | } |
1108 | 1136 | ||
1109 | private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlTextReader reader) | 1137 | private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlReader reader) |
1110 | { | 1138 | { |
1111 | shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); | 1139 | shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); |
1112 | } | 1140 | } |
1113 | 1141 | ||
1114 | private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlTextReader reader) | 1142 | private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlReader reader) |
1115 | { | 1143 | { |
1116 | shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); | 1144 | shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); |
1117 | } | 1145 | } |
1118 | 1146 | ||
1119 | private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlTextReader reader) | 1147 | private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlReader reader) |
1120 | { | 1148 | { |
1121 | shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); | 1149 | shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); |
1122 | } | 1150 | } |
1123 | 1151 | ||
1124 | private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlTextReader reader) | 1152 | private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlReader reader) |
1125 | { | 1153 | { |
1126 | shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); | 1154 | shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); |
1127 | } | 1155 | } |
1128 | 1156 | ||
1129 | private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlTextReader reader) | 1157 | private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlReader reader) |
1130 | { | 1158 | { |
1131 | shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); | 1159 | shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); |
1132 | } | 1160 | } |
1133 | 1161 | ||
1134 | private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlTextReader reader) | 1162 | private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlReader reader) |
1135 | { | 1163 | { |
1136 | shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); | 1164 | shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); |
1137 | } | 1165 | } |
1138 | 1166 | ||
1139 | private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlTextReader reader) | 1167 | private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlReader reader) |
1140 | { | 1168 | { |
1141 | shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); | 1169 | shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); |
1142 | } | 1170 | } |
1143 | 1171 | ||
1144 | private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlTextReader reader) | 1172 | private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlReader reader) |
1145 | { | 1173 | { |
1146 | shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); | 1174 | shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); |
1147 | } | 1175 | } |
1148 | 1176 | ||
1149 | private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlTextReader reader) | 1177 | private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlReader reader) |
1150 | { | 1178 | { |
1151 | shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); | 1179 | shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); |
1152 | } | 1180 | } |
1153 | 1181 | ||
1154 | private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlTextReader reader) | 1182 | private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlReader reader) |
1155 | { | 1183 | { |
1156 | shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); | 1184 | shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); |
1157 | } | 1185 | } |
1158 | 1186 | ||
1159 | private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlTextReader reader) | 1187 | private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlReader reader) |
1160 | { | 1188 | { |
1161 | shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); | 1189 | shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); |
1162 | } | 1190 | } |
1163 | 1191 | ||
1164 | private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlTextReader reader) | 1192 | private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlReader reader) |
1165 | { | 1193 | { |
1166 | shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); | 1194 | shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); |
1167 | } | 1195 | } |
1168 | 1196 | ||
1169 | private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlTextReader reader) | 1197 | private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlReader reader) |
1170 | { | 1198 | { |
1171 | shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); | 1199 | shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); |
1172 | } | 1200 | } |
1173 | 1201 | ||
1174 | private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlTextReader reader) | 1202 | private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlReader reader) |
1175 | { | 1203 | { |
1176 | shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); | 1204 | shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); |
1177 | } | 1205 | } |
1178 | 1206 | ||
1179 | private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlTextReader reader) | 1207 | private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlReader reader) |
1180 | { | 1208 | { |
1181 | shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); | 1209 | shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); |
1182 | } | 1210 | } |
1183 | 1211 | ||
1184 | private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlTextReader reader) | 1212 | private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlReader reader) |
1185 | { | 1213 | { |
1186 | shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); | 1214 | shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); |
1187 | } | 1215 | } |
1188 | 1216 | ||
1189 | private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlTextReader reader) | 1217 | private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlReader reader) |
1190 | { | 1218 | { |
1191 | shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); | 1219 | shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); |
1192 | } | 1220 | } |
1193 | 1221 | ||
1194 | private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) | 1222 | private static void ProcessShpScale(PrimitiveBaseShape shp, XmlReader reader) |
1195 | { | 1223 | { |
1196 | shp.Scale = Util.ReadVector(reader, "Scale"); | 1224 | shp.Scale = Util.ReadVector(reader, "Scale"); |
1197 | } | 1225 | } |
1198 | 1226 | ||
1199 | private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) | 1227 | private static void ProcessShpState(PrimitiveBaseShape shp, XmlReader reader) |
1200 | { | 1228 | { |
1201 | shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); | 1229 | shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); |
1202 | } | 1230 | } |
1203 | 1231 | ||
1204 | private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader) | 1232 | private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlReader reader) |
1205 | { | 1233 | { |
1206 | shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty); | 1234 | shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty); |
1207 | } | 1235 | } |
1208 | 1236 | ||
1209 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) | 1237 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlReader reader) |
1210 | { | 1238 | { |
1211 | shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); | 1239 | shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); |
1212 | } | 1240 | } |
1213 | 1241 | ||
1214 | private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) | 1242 | private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlReader reader) |
1215 | { | 1243 | { |
1216 | shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); | 1244 | shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); |
1217 | } | 1245 | } |
1218 | 1246 | ||
1219 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) | 1247 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader) |
1220 | { | 1248 | { |
1221 | shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); | 1249 | shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); |
1222 | } | 1250 | } |
1223 | 1251 | ||
1224 | private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) | 1252 | private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlReader reader) |
1225 | { | 1253 | { |
1226 | shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); | 1254 | shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); |
1227 | } | 1255 | } |
1228 | 1256 | ||
1229 | private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader) | 1257 | private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlReader reader) |
1230 | { | ||
1231 | // m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length); | ||
1232 | |||
1233 | shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData")); | ||
1234 | } | ||
1235 | |||
1236 | private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader) | ||
1237 | { | 1258 | { |
1238 | shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); | 1259 | shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); |
1239 | } | 1260 | } |
1240 | 1261 | ||
1241 | private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlTextReader reader) | 1262 | private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlReader reader) |
1242 | { | 1263 | { |
1243 | shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); | 1264 | shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); |
1244 | } | 1265 | } |
1245 | 1266 | ||
1246 | private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlTextReader reader) | 1267 | private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlReader reader) |
1247 | { | 1268 | { |
1248 | shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); | 1269 | shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); |
1249 | } | 1270 | } |
1250 | 1271 | ||
1251 | private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlTextReader reader) | 1272 | private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlReader reader) |
1252 | { | 1273 | { |
1253 | shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); | 1274 | shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); |
1254 | } | 1275 | } |
1255 | 1276 | ||
1256 | private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlTextReader reader) | 1277 | private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlReader reader) |
1257 | { | 1278 | { |
1258 | shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); | 1279 | shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); |
1259 | } | 1280 | } |
1260 | 1281 | ||
1261 | private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlTextReader reader) | 1282 | private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlReader reader) |
1262 | { | 1283 | { |
1263 | shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); | 1284 | shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); |
1264 | } | 1285 | } |
1265 | 1286 | ||
1266 | private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlTextReader reader) | 1287 | private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlReader reader) |
1267 | { | 1288 | { |
1268 | shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); | 1289 | shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); |
1269 | } | 1290 | } |
1270 | 1291 | ||
1271 | private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlTextReader reader) | 1292 | private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlReader reader) |
1272 | { | 1293 | { |
1273 | shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); | 1294 | shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); |
1274 | } | 1295 | } |
1275 | 1296 | ||
1276 | private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlTextReader reader) | 1297 | private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlReader reader) |
1277 | { | 1298 | { |
1278 | shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); | 1299 | shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); |
1279 | } | 1300 | } |
1280 | 1301 | ||
1281 | private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlTextReader reader) | 1302 | private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlReader reader) |
1282 | { | 1303 | { |
1283 | shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); | 1304 | shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); |
1284 | } | 1305 | } |
1285 | 1306 | ||
1286 | private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlTextReader reader) | 1307 | private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlReader reader) |
1287 | { | 1308 | { |
1288 | shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); | 1309 | shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); |
1289 | } | 1310 | } |
1290 | 1311 | ||
1291 | private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlTextReader reader) | 1312 | private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlReader reader) |
1292 | { | 1313 | { |
1293 | shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); | 1314 | shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); |
1294 | } | 1315 | } |
1295 | 1316 | ||
1296 | private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlTextReader reader) | 1317 | private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlReader reader) |
1297 | { | 1318 | { |
1298 | shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); | 1319 | shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); |
1299 | } | 1320 | } |
1300 | 1321 | ||
1301 | private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlTextReader reader) | 1322 | private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlReader reader) |
1302 | { | 1323 | { |
1303 | shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); | 1324 | shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); |
1304 | } | 1325 | } |
1305 | 1326 | ||
1306 | private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlTextReader reader) | 1327 | private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlReader reader) |
1307 | { | 1328 | { |
1308 | shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); | 1329 | shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); |
1309 | } | 1330 | } |
1310 | 1331 | ||
1311 | private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlTextReader reader) | 1332 | private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlReader reader) |
1312 | { | 1333 | { |
1313 | shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); | 1334 | shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); |
1314 | } | 1335 | } |
1315 | 1336 | ||
1316 | private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1337 | private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlReader reader) |
1317 | { | 1338 | { |
1318 | shp.FlexiEntry = Util.ReadBoolean(reader); | 1339 | shp.FlexiEntry = Util.ReadBoolean(reader); |
1319 | } | 1340 | } |
1320 | 1341 | ||
1321 | private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1342 | private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlReader reader) |
1322 | { | 1343 | { |
1323 | shp.LightEntry = Util.ReadBoolean(reader); | 1344 | shp.LightEntry = Util.ReadBoolean(reader); |
1324 | } | 1345 | } |
1325 | 1346 | ||
1326 | private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1347 | private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlReader reader) |
1327 | { | 1348 | { |
1328 | shp.SculptEntry = Util.ReadBoolean(reader); | 1349 | shp.SculptEntry = Util.ReadBoolean(reader); |
1329 | } | 1350 | } |
1330 | 1351 | ||
1331 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) | 1352 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) |
1332 | { | 1353 | { |
1333 | string value = reader.ReadElementContentAsString("Media", String.Empty); | 1354 | string value = reader.ReadElementContentAsString("Media", String.Empty); |
1334 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | 1355 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); |
@@ -1382,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1382 | if (m_UserManagement == null) | 1403 | if (m_UserManagement == null) |
1383 | m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); | 1404 | m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); |
1384 | string name = m_UserManagement.GetUserName(sop.CreatorID); | 1405 | string name = m_UserManagement.GetUserName(sop.CreatorID); |
1385 | writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); | 1406 | writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name)); |
1386 | } | 1407 | } |
1387 | 1408 | ||
1388 | WriteUUID(writer, "FolderID", sop.FolderID, options); | 1409 | WriteUUID(writer, "FolderID", sop.FolderID, options); |
@@ -1435,7 +1456,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1435 | writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); | 1456 | writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); |
1436 | writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); | 1457 | writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); |
1437 | writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); | 1458 | writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); |
1438 | WriteUUID(writer, "GroupID", sop.GroupID, options); | 1459 | |
1460 | UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID; | ||
1461 | WriteUUID(writer, "GroupID", groupID, options); | ||
1439 | 1462 | ||
1440 | UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; | 1463 | UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; |
1441 | WriteUUID(writer, "OwnerID", ownerID, options); | 1464 | WriteUUID(writer, "OwnerID", ownerID, options); |
@@ -1575,13 +1598,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1575 | if (m_UserManagement == null) | 1598 | if (m_UserManagement == null) |
1576 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | 1599 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); |
1577 | string name = m_UserManagement.GetUserName(item.CreatorID); | 1600 | string name = m_UserManagement.GetUserName(item.CreatorID); |
1578 | writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); | 1601 | writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name)); |
1579 | } | 1602 | } |
1580 | 1603 | ||
1581 | writer.WriteElementString("Description", item.Description); | 1604 | writer.WriteElementString("Description", item.Description); |
1582 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); | 1605 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); |
1583 | writer.WriteElementString("Flags", item.Flags.ToString()); | 1606 | writer.WriteElementString("Flags", item.Flags.ToString()); |
1584 | WriteUUID(writer, "GroupID", item.GroupID, options); | 1607 | |
1608 | UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID; | ||
1609 | WriteUUID(writer, "GroupID", groupID, options); | ||
1610 | |||
1585 | writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); | 1611 | writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); |
1586 | writer.WriteElementString("InvType", item.InvType.ToString()); | 1612 | writer.WriteElementString("InvType", item.InvType.ToString()); |
1587 | WriteUUID(writer, "ItemID", item.ItemID, options); | 1613 | WriteUUID(writer, "ItemID", item.ItemID, options); |
@@ -1602,7 +1628,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1602 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); | 1628 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); |
1603 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); | 1629 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); |
1604 | writer.WriteElementString("Type", item.Type.ToString()); | 1630 | writer.WriteElementString("Type", item.Type.ToString()); |
1605 | writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); | 1631 | |
1632 | bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged; | ||
1633 | writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower()); | ||
1606 | 1634 | ||
1607 | writer.WriteEndElement(); // TaskInventoryItem | 1635 | writer.WriteEndElement(); // TaskInventoryItem |
1608 | } | 1636 | } |
@@ -1663,14 +1691,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1663 | 1691 | ||
1664 | WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); | 1692 | WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); |
1665 | writer.WriteElementString("SculptType", shp.SculptType.ToString()); | 1693 | writer.WriteElementString("SculptType", shp.SculptType.ToString()); |
1666 | writer.WriteStartElement("SculptData"); | 1694 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. |
1667 | byte[] sd; | ||
1668 | if (shp.SculptData != null) | ||
1669 | sd = shp.SculptData; | ||
1670 | else | ||
1671 | sd = Utils.EmptyBytes; | ||
1672 | writer.WriteBase64(sd, 0, sd.Length); | ||
1673 | writer.WriteEndElement(); // SculptData | ||
1674 | 1695 | ||
1675 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); | 1696 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); |
1676 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); | 1697 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); |
@@ -1701,28 +1722,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1701 | } | 1722 | } |
1702 | } | 1723 | } |
1703 | 1724 | ||
1704 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) | 1725 | public static SceneObjectPart Xml2ToSOP(XmlReader reader) |
1705 | { | 1726 | { |
1706 | SceneObjectPart obj = new SceneObjectPart(); | 1727 | SceneObjectPart obj = new SceneObjectPart(); |
1707 | 1728 | ||
1708 | reader.ReadStartElement("SceneObjectPart"); | 1729 | reader.ReadStartElement("SceneObjectPart"); |
1709 | 1730 | ||
1710 | ExternalRepresentationUtils.ExecuteReadProcessors( | 1731 | bool errors = ExternalRepresentationUtils.ExecuteReadProcessors( |
1711 | obj, | 1732 | obj, |
1712 | m_SOPXmlProcessors, | 1733 | m_SOPXmlProcessors, |
1713 | reader, | 1734 | reader, |
1714 | (o, nodeName, e) | 1735 | (o, nodeName, e) => { |
1715 | => m_log.DebugFormat( | 1736 | m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in object {1} {2} ", |
1716 | "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", | 1737 | nodeName, ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID), e); |
1717 | ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); | 1738 | }); |
1739 | |||
1740 | if (errors) | ||
1741 | throw new XmlException(string.Format("Error parsing object {0} {1}", obj.Name, obj.UUID)); | ||
1718 | 1742 | ||
1719 | reader.ReadEndElement(); // SceneObjectPart | 1743 | reader.ReadEndElement(); // SceneObjectPart |
1720 | 1744 | ||
1721 | //m_log.DebugFormat("[XXX]: parsed SOP {0} - {1}", obj.Name, obj.UUID); | 1745 | // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); |
1722 | return obj; | 1746 | return obj; |
1723 | } | 1747 | } |
1724 | 1748 | ||
1725 | public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) | 1749 | public static TaskInventoryDictionary ReadTaskInventory(XmlReader reader, string name) |
1726 | { | 1750 | { |
1727 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1751 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1728 | 1752 | ||
@@ -1757,7 +1781,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1757 | /// <param name="name">The name of the xml element containing the shape</param> | 1781 | /// <param name="name">The name of the xml element containing the shape</param> |
1758 | /// <param name="errors">a list containing the failing node names. If no failures then null.</param> | 1782 | /// <param name="errors">a list containing the failing node names. If no failures then null.</param> |
1759 | /// <returns>The shape parsed</returns> | 1783 | /// <returns>The shape parsed</returns> |
1760 | public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) | 1784 | public static PrimitiveBaseShape ReadShape(XmlReader reader, string name, out List<string> errorNodeNames, SceneObjectPart obj) |
1761 | { | 1785 | { |
1762 | List<string> internalErrorNodeNames = null; | 1786 | List<string> internalErrorNodeNames = null; |
1763 | 1787 | ||
@@ -1776,18 +1800,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1776 | shape, | 1800 | shape, |
1777 | m_ShapeXmlProcessors, | 1801 | m_ShapeXmlProcessors, |
1778 | reader, | 1802 | reader, |
1779 | (o, nodeName, e) | 1803 | (o, nodeName, e) => { |
1780 | => | 1804 | m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in Shape property of object {1} {2} ", |
1781 | { | 1805 | nodeName, obj.Name, obj.UUID), e); |
1782 | // m_log.DebugFormat( | ||
1783 | // "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", | ||
1784 | // nodeName, e.Message, e.StackTrace); | ||
1785 | if (internalErrorNodeNames == null) | ||
1786 | internalErrorNodeNames = new List<string>(); | ||
1787 | 1806 | ||
1788 | internalErrorNodeNames.Add(nodeName); | 1807 | if (internalErrorNodeNames == null) |
1789 | } | 1808 | internalErrorNodeNames = new List<string>(); |
1790 | ); | 1809 | internalErrorNodeNames.Add(nodeName); |
1810 | }); | ||
1791 | 1811 | ||
1792 | reader.ReadEndElement(); // Shape | 1812 | reader.ReadEndElement(); // Shape |
1793 | 1813 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index bf32251..52e3ff1 100644..100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -61,6 +61,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | 61 | ||
62 | private YourStatsAreWrong handlerStatsIncorrect; | 62 | private YourStatsAreWrong handlerStatsIncorrect; |
63 | 63 | ||
64 | // Determines the size of the array that is used to collect StatBlocks | ||
65 | // for sending to the SimStats and SimExtraStatsCollector | ||
66 | private const int m_statisticArraySize = 28; | ||
67 | |||
64 | /// <summary> | 68 | /// <summary> |
65 | /// These are the IDs of stats sent in the StatsPacket to the viewer. | 69 | /// These are the IDs of stats sent in the StatsPacket to the viewer. |
66 | /// </summary> | 70 | /// </summary> |
@@ -104,7 +108,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | ScriptEps = 31, | 108 | ScriptEps = 31, |
105 | SimSpareMs = 32, | 109 | SimSpareMs = 32, |
106 | SimSleepMs = 33, | 110 | SimSleepMs = 33, |
107 | SimIoPumpTime = 34 | 111 | SimIoPumpTime = 34, |
112 | FrameDilation = 35, | ||
113 | UsersLoggingIn = 36, | ||
114 | TotalGeoPrim = 37, | ||
115 | TotalMesh = 38, | ||
116 | ThreadCount = 39 | ||
108 | } | 117 | } |
109 | 118 | ||
110 | /// <summary> | 119 | /// <summary> |
@@ -175,7 +184,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | 184 | ||
176 | // saved last reported value so there is something available for llGetRegionFPS | 185 | // saved last reported value so there is something available for llGetRegionFPS |
177 | private float lastReportedSimFPS; | 186 | private float lastReportedSimFPS; |
187 | <<<<<<< HEAD | ||
188 | private float[] lastReportedSimStats = new float[m_statisticArraySize]; | ||
189 | ======= | ||
178 | private float[] lastReportedSimStats = new float[23]; | 190 | private float[] lastReportedSimStats = new float[23]; |
191 | >>>>>>> avn/ubitvar | ||
179 | private float m_pfps; | 192 | private float m_pfps; |
180 | 193 | ||
181 | /// <summary> | 194 | /// <summary> |
@@ -195,14 +208,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
195 | private int m_physicsMS; | 208 | private int m_physicsMS; |
196 | private int m_imageMS; | 209 | private int m_imageMS; |
197 | private int m_otherMS; | 210 | private int m_otherMS; |
211 | <<<<<<< HEAD | ||
212 | private int m_scriptMS; | ||
213 | ======= | ||
198 | private int m_sleeptimeMS; | 214 | private int m_sleeptimeMS; |
199 | 215 | ||
200 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | 216 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. |
201 | //Ckrinke private int m_scriptMS = 0; | 217 | //Ckrinke private int m_scriptMS = 0; |
218 | >>>>>>> avn/ubitvar | ||
202 | 219 | ||
203 | private int m_rootAgents; | 220 | private int m_rootAgents; |
204 | private int m_childAgents; | 221 | private int m_childAgents; |
205 | private int m_numPrim; | 222 | private int m_numPrim; |
223 | private int m_numGeoPrim; | ||
224 | private int m_numMesh; | ||
206 | private int m_inPacketsPerSecond; | 225 | private int m_inPacketsPerSecond; |
207 | private int m_outPacketsPerSecond; | 226 | private int m_outPacketsPerSecond; |
208 | private int m_activePrim; | 227 | private int m_activePrim; |
@@ -214,6 +233,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | 233 | ||
215 | private int m_objectCapacity = 45000; | 234 | private int m_objectCapacity = 45000; |
216 | 235 | ||
236 | // This is the number of frames that will be stored and then averaged for | ||
237 | // the Total, Simulation, Physics, and Network Frame Time; It is set to | ||
238 | // 10 by default but can be changed by the OpenSim.ini configuration file | ||
239 | // NumberOfFrames parameter | ||
240 | private int m_numberFramesStored; | ||
241 | |||
242 | // The arrays that will hold the time it took to run the past N frames, | ||
243 | // where N is the num_frames_to_average given by the configuration file | ||
244 | private double[] m_totalFrameTimeMilliseconds; | ||
245 | private double[] m_simulationFrameTimeMilliseconds; | ||
246 | private double[] m_physicsFrameTimeMilliseconds; | ||
247 | private double[] m_networkFrameTimeMilliseconds; | ||
248 | |||
249 | // The location of the next time in milliseconds that will be | ||
250 | // (over)written when the next frame completes | ||
251 | private int m_nextLocation = 0; | ||
252 | |||
253 | // The correct number of frames that have completed since the last stats | ||
254 | // update for physics | ||
255 | private int m_numberPhysicsFrames; | ||
256 | |||
257 | // The current number of users attempting to login to the region | ||
258 | private int m_usersLoggingIn; | ||
259 | |||
260 | // The last reported value of threads from the SmartThreadPool inside of | ||
261 | // XEngine | ||
262 | private int m_inUseThreads; | ||
263 | |||
217 | private Scene m_scene; | 264 | private Scene m_scene; |
218 | 265 | ||
219 | private RegionInfo ReportingRegion; | 266 | private RegionInfo ReportingRegion; |
@@ -223,9 +270,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
223 | private IEstateModule estateModule; | 270 | private IEstateModule estateModule; |
224 | 271 | ||
225 | public SimStatsReporter(Scene scene) | 272 | public SimStatsReporter(Scene scene) |
273 | : this(scene, Scene.m_defaultNumberFramesStored) | ||
226 | { | 274 | { |
275 | } | ||
276 | |||
277 | public SimStatsReporter(Scene scene, int numberOfFrames) | ||
278 | { | ||
279 | // Store the number of frames from the OpenSim.ini configuration file | ||
280 | m_numberFramesStored = numberOfFrames; | ||
281 | |||
282 | // Initialize the different frame time arrays to the correct sizes | ||
283 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
284 | m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
285 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
286 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
287 | |||
288 | // Initialize the current number of users logging into the region | ||
289 | m_usersLoggingIn = 0; | ||
290 | |||
227 | m_scene = scene; | 291 | m_scene = scene; |
228 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; | 292 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; |
229 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 293 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
230 | ReportingRegion = scene.RegionInfo; | 294 | ReportingRegion = scene.RegionInfo; |
231 | 295 | ||
@@ -240,7 +304,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | 304 | ||
241 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | 305 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit |
242 | /// longer than ideal (which in itself is a concern). | 306 | /// longer than ideal (which in itself is a concern). |
243 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); | 307 | SlowFramesStatReportThreshold = (int)Math.Ceiling(scene.MinFrameTicks * 1.2); |
244 | 308 | ||
245 | SlowFramesStat | 309 | SlowFramesStat |
246 | = new Stat( | 310 | = new Stat( |
@@ -255,8 +319,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
255 | StatVerbosity.Info); | 319 | StatVerbosity.Info); |
256 | 320 | ||
257 | StatsManager.RegisterStat(SlowFramesStat); | 321 | StatsManager.RegisterStat(SlowFramesStat); |
322 | |||
258 | } | 323 | } |
259 | 324 | ||
325 | |||
260 | public void Close() | 326 | public void Close() |
261 | { | 327 | { |
262 | m_report.Elapsed -= TriggerStatsHeartbeat; | 328 | m_report.Elapsed -= TriggerStatsHeartbeat; |
@@ -290,10 +356,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
290 | 356 | ||
291 | private void statsHeartBeat(object sender, EventArgs e) | 357 | private void statsHeartBeat(object sender, EventArgs e) |
292 | { | 358 | { |
359 | double totalSumFrameTime; | ||
360 | double simulationSumFrameTime; | ||
361 | double physicsSumFrameTime; | ||
362 | double networkSumFrameTime; | ||
363 | float frameDilation; | ||
364 | int currentFrame; | ||
365 | |||
293 | if (!m_scene.Active) | 366 | if (!m_scene.Active) |
294 | return; | 367 | return; |
295 | 368 | ||
369 | <<<<<<< HEAD | ||
370 | // Create arrays to hold the statistics for this current scene, | ||
371 | // these will be passed to the SimExtraStatsCollector, they are also | ||
372 | // sent to the SimStats class | ||
373 | SimStatsPacket.StatBlock[] sb = new | ||
374 | SimStatsPacket.StatBlock[m_statisticArraySize]; | ||
375 | ======= | ||
296 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; | 376 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
377 | >>>>>>> avn/ubitvar | ||
297 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 378 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
298 | 379 | ||
299 | // Know what's not thread safe in Mono... modifying timers. | 380 | // Know what's not thread safe in Mono... modifying timers. |
@@ -315,14 +396,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
315 | 396 | ||
316 | #region various statistic googly moogly | 397 | #region various statistic googly moogly |
317 | 398 | ||
399 | // ORIGINAL code commented out until we have time to add our own | ||
400 | // statistics to the statistics window, this will be done as a | ||
401 | // new section given the title of our current project | ||
318 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | 402 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently |
319 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | 403 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. |
320 | int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | 404 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); |
405 | int reportedFPS = m_fps; | ||
321 | 406 | ||
322 | // save the reported value so there is something available for llGetRegionFPS | 407 | // save the reported value so there is something available for llGetRegionFPS |
323 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 408 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
324 | 409 | ||
325 | float physfps = ((m_pfps / 1000)); | 410 | // ORIGINAL code commented out until we have time to add our own |
411 | // statistics to the statistics window | ||
412 | //float physfps = ((m_pfps / 1000)); | ||
413 | float physfps = m_numberPhysicsFrames; | ||
326 | 414 | ||
327 | //if (physfps > 600) | 415 | //if (physfps > 600) |
328 | //physfps = physfps - (physfps - 600); | 416 | //physfps = physfps - (physfps - 600); |
@@ -364,6 +452,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
364 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | 452 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); |
365 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); | 453 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); |
366 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); | 454 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); |
455 | m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount(); | ||
456 | m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount(); | ||
367 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | 457 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); |
368 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | 458 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); |
369 | 459 | ||
@@ -375,15 +465,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
375 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; | 465 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
376 | // m_imageMS m_netMS are not included in m_frameMS | 466 | // m_imageMS m_netMS are not included in m_frameMS |
377 | 467 | ||
468 | <<<<<<< HEAD | ||
469 | uint thisFrame = m_scene.Frame; | ||
470 | uint numFrames = thisFrame - m_lastUpdateFrame; | ||
471 | float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; | ||
472 | m_lastUpdateFrame = thisFrame; | ||
473 | |||
474 | // Avoid div-by-zero if somehow we've not updated any frames. | ||
475 | if (framesUpdated == 0) | ||
476 | framesUpdated = 1; | ||
477 | |||
478 | for (int i = 0; i < m_statisticArraySize; i++) | ||
479 | ======= | ||
378 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; | 480 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; |
379 | if (m_otherMS < 0) | 481 | if (m_otherMS < 0) |
380 | m_otherMS = 0; | 482 | m_otherMS = 0; |
381 | 483 | ||
382 | for (int i = 0; i < 23; i++) | 484 | for (int i = 0; i < 23; i++) |
485 | >>>>>>> avn/ubitvar | ||
383 | { | 486 | { |
384 | sb[i] = new SimStatsPacket.StatBlock(); | 487 | sb[i] = new SimStatsPacket.StatBlock(); |
385 | } | 488 | } |
386 | 489 | ||
490 | // Resetting the sums of the frame times to prevent any errors | ||
491 | // in calculating the moving average for frame time | ||
492 | totalSumFrameTime = 0; | ||
493 | simulationSumFrameTime = 0; | ||
494 | physicsSumFrameTime = 0; | ||
495 | networkSumFrameTime = 0; | ||
496 | |||
497 | // Loop through all the frames that were stored for the current | ||
498 | // heartbeat to process the moving average of frame times | ||
499 | for (int i = 0; i < m_numberFramesStored; i++) | ||
500 | { | ||
501 | // Sum up each frame time in order to calculate the moving | ||
502 | // average of frame time | ||
503 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; | ||
504 | simulationSumFrameTime += | ||
505 | m_simulationFrameTimeMilliseconds[i]; | ||
506 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; | ||
507 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; | ||
508 | } | ||
509 | |||
510 | // Get the index that represents the current frame based on the next one known; go back | ||
511 | // to the last index if next one is stated to restart at 0 | ||
512 | if (m_nextLocation == 0) | ||
513 | currentFrame = m_numberFramesStored - 1; | ||
514 | else | ||
515 | currentFrame = m_nextLocation - 1; | ||
516 | |||
517 | // Calculate the frame dilation; which is currently based on the ratio between the sum of the | ||
518 | // physics and simulation rate, and the set minimum time to run a scene's frame | ||
519 | frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + | ||
520 | m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks; | ||
521 | |||
522 | // ORIGINAL code commented out until we have time to add our own | ||
387 | sb[0].StatID = (uint) Stats.TimeDilation; | 523 | sb[0].StatID = (uint) Stats.TimeDilation; |
388 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 524 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
389 | 525 | ||
@@ -408,7 +544,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
408 | sb[7].StatID = (uint) Stats.ActivePrim; | 544 | sb[7].StatID = (uint) Stats.ActivePrim; |
409 | sb[7].StatValue = m_activePrim; | 545 | sb[7].StatValue = m_activePrim; |
410 | 546 | ||
547 | // ORIGINAL code commented out until we have time to add our own | ||
548 | // statistics to the statistics window | ||
411 | sb[8].StatID = (uint)Stats.FrameMS; | 549 | sb[8].StatID = (uint)Stats.FrameMS; |
550 | <<<<<<< HEAD | ||
551 | //sb[8].StatValue = m_frameMS / framesUpdated; | ||
552 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; | ||
553 | |||
554 | sb[9].StatID = (uint)Stats.NetMS; | ||
555 | //sb[9].StatValue = m_netMS / framesUpdated; | ||
556 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; | ||
557 | |||
558 | sb[10].StatID = (uint)Stats.PhysicsMS; | ||
559 | //sb[10].StatValue = m_physicsMS / framesUpdated; | ||
560 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; | ||
561 | ======= | ||
412 | sb[8].StatValue = TotalFrameTime; | 562 | sb[8].StatValue = TotalFrameTime; |
413 | 563 | ||
414 | sb[9].StatID = (uint)Stats.NetMS; | 564 | sb[9].StatID = (uint)Stats.NetMS; |
@@ -416,12 +566,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | 566 | ||
417 | sb[10].StatID = (uint)Stats.PhysicsMS; | 567 | sb[10].StatID = (uint)Stats.PhysicsMS; |
418 | sb[10].StatValue = m_physicsMS * perframe; | 568 | sb[10].StatValue = m_physicsMS * perframe; |
569 | >>>>>>> avn/ubitvar | ||
419 | 570 | ||
420 | sb[11].StatID = (uint)Stats.ImageMS ; | 571 | sb[11].StatID = (uint)Stats.ImageMS ; |
421 | sb[11].StatValue = m_imageMS * perframe; | 572 | sb[11].StatValue = m_imageMS * perframe; |
422 | 573 | ||
423 | sb[12].StatID = (uint)Stats.OtherMS; | 574 | sb[12].StatID = (uint)Stats.OtherMS; |
575 | <<<<<<< HEAD | ||
576 | //sb[12].StatValue = m_otherMS / framesUpdated; | ||
577 | sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; | ||
578 | ======= | ||
424 | sb[12].StatValue = m_otherMS * perframe; | 579 | sb[12].StatValue = m_otherMS * perframe; |
580 | >>>>>>> avn/ubitvar | ||
425 | 581 | ||
426 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 582 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
427 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); | 583 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |
@@ -453,7 +609,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
453 | sb[22].StatID = (uint)Stats.SimSleepMs; | 609 | sb[22].StatID = (uint)Stats.SimSleepMs; |
454 | sb[22].StatValue = sleeptime; | 610 | sb[22].StatValue = sleeptime; |
455 | 611 | ||
456 | for (int i = 0; i < 22; i++) | 612 | // Current ratio between the sum of physics and sim rate, and the |
613 | // minimum time to run a scene's frame | ||
614 | sb[22].StatID = (uint)Stats.FrameDilation; | ||
615 | sb[22].StatValue = frameDilation; | ||
616 | |||
617 | // Current number of users currently attemptint to login to region | ||
618 | sb[23].StatID = (uint)Stats.UsersLoggingIn; | ||
619 | sb[23].StatValue = m_usersLoggingIn; | ||
620 | |||
621 | // Total number of geometric primitives in the scene | ||
622 | sb[24].StatID = (uint)Stats.TotalGeoPrim; | ||
623 | sb[24].StatValue = m_numGeoPrim; | ||
624 | |||
625 | // Total number of mesh objects in the scene | ||
626 | sb[25].StatID = (uint)Stats.TotalMesh; | ||
627 | sb[25].StatValue = m_numMesh; | ||
628 | |||
629 | // Current number of threads that XEngine is using | ||
630 | sb[26].StatID = (uint)Stats.ThreadCount; | ||
631 | sb[26].StatValue = m_inUseThreads; | ||
632 | |||
633 | sb[27].StatID = (uint)Stats.ScriptMS; | ||
634 | sb[27].StatValue = (numFrames <= 0) ? 0 : ((float)m_scriptMS / numFrames); | ||
635 | |||
636 | for (int i = 0; i < m_statisticArraySize; i++) | ||
457 | { | 637 | { |
458 | lastReportedSimStats[i] = sb[i].StatValue; | 638 | lastReportedSimStats[i] = sb[i].StatValue; |
459 | } | 639 | } |
@@ -502,6 +682,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
502 | 682 | ||
503 | private void ResetValues() | 683 | private void ResetValues() |
504 | { | 684 | { |
685 | // Reset the number of frames that the physics library has | ||
686 | // processed since the last stats report | ||
687 | m_numberPhysicsFrames = 0; | ||
688 | |||
505 | m_timeDilation = 0; | 689 | m_timeDilation = 0; |
506 | m_fps = 0; | 690 | m_fps = 0; |
507 | m_pfps = 0; | 691 | m_pfps = 0; |
@@ -518,11 +702,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
518 | m_physicsMS = 0; | 702 | m_physicsMS = 0; |
519 | m_imageMS = 0; | 703 | m_imageMS = 0; |
520 | m_otherMS = 0; | 704 | m_otherMS = 0; |
705 | <<<<<<< HEAD | ||
706 | m_scriptMS = 0; | ||
707 | m_spareMS = 0; | ||
708 | ======= | ||
521 | // m_spareMS = 0; | 709 | // m_spareMS = 0; |
522 | m_sleeptimeMS = 0; | 710 | m_sleeptimeMS = 0; |
523 | 711 | ||
524 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 712 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
525 | //Ckrinke m_scriptMS = 0; | 713 | //Ckrinke m_scriptMS = 0; |
714 | >>>>>>> avn/ubitvar | ||
526 | } | 715 | } |
527 | 716 | ||
528 | # region methods called from Scene | 717 | # region methods called from Scene |
@@ -628,9 +817,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
628 | m_otherMS += ms; | 817 | m_otherMS += ms; |
629 | } | 818 | } |
630 | 819 | ||
820 | <<<<<<< HEAD | ||
821 | public void AddScriptMS(int ms) | ||
822 | { | ||
823 | m_scriptMS += ms; | ||
824 | } | ||
825 | |||
826 | public void addPhysicsFrame(int frames) | ||
827 | { | ||
828 | // Add the number of physics frames to the correct total physics | ||
829 | // frames | ||
830 | m_numberPhysicsFrames += frames; | ||
831 | } | ||
832 | |||
833 | public void addFrameTimeMilliseconds(double total, double simulation, | ||
834 | double physics, double network) | ||
835 | { | ||
836 | // Save the frame times from the current frame into the appropriate | ||
837 | // arrays | ||
838 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; | ||
839 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; | ||
840 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; | ||
841 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; | ||
842 | |||
843 | // Update to the next location in the list | ||
844 | m_nextLocation++; | ||
845 | |||
846 | // Since the list will begin to overwrite the oldest frame values | ||
847 | // first, the next location needs to loop back to the beginning of the | ||
848 | // list whenever it reaches the end | ||
849 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
850 | ======= | ||
631 | public void addSleepMS(int ms) | 851 | public void addSleepMS(int ms) |
632 | { | 852 | { |
633 | m_sleeptimeMS += ms; | 853 | m_sleeptimeMS += ms; |
854 | >>>>>>> avn/ubitvar | ||
634 | } | 855 | } |
635 | 856 | ||
636 | public void AddPendingDownloads(int count) | 857 | public void AddPendingDownloads(int count) |
@@ -655,6 +876,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
655 | AddunAckedBytes(unAckedBytes); | 876 | AddunAckedBytes(unAckedBytes); |
656 | } | 877 | } |
657 | 878 | ||
879 | public void UpdateUsersLoggingIn(bool isLoggingIn) | ||
880 | { | ||
881 | // Determine whether the user has started logging in or has completed | ||
882 | // logging into the region | ||
883 | if (isLoggingIn) | ||
884 | { | ||
885 | // The user is starting to login to the region so increment the | ||
886 | // number of users attempting to login to the region | ||
887 | m_usersLoggingIn++; | ||
888 | } | ||
889 | else | ||
890 | { | ||
891 | // The user has finished logging into the region so decrement the | ||
892 | // number of users logging into the region | ||
893 | m_usersLoggingIn--; | ||
894 | } | ||
895 | } | ||
896 | |||
897 | public void SetThreadCount(int inUseThreads) | ||
898 | { | ||
899 | // Save the new number of threads to our member variable to send to | ||
900 | // the extra stats collector | ||
901 | m_inUseThreads = inUseThreads; | ||
902 | } | ||
903 | |||
658 | #endregion | 904 | #endregion |
659 | 905 | ||
660 | public Dictionary<string, float> GetExtraSimStats() | 906 | public Dictionary<string, float> GetExtraSimStats() |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 6abdc29..6fd9096 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | private static string LogHeader = "[TERRAIN CHANNEL]"; | 51 | private static string LogHeader = "[TERRAIN CHANNEL]"; |
52 | <<<<<<< HEAD | ||
52 | 53 | ||
53 | protected TerrainData m_terrainData; | 54 | protected TerrainData m_terrainData; |
54 | 55 | ||
@@ -57,6 +58,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
57 | public int Height { get { return m_terrainData.SizeY; } } // Y dimension | 58 | public int Height { get { return m_terrainData.SizeY; } } // Y dimension |
58 | public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension | 59 | public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension |
59 | 60 | ||
61 | ======= | ||
62 | |||
63 | protected TerrainData m_terrainData; | ||
64 | |||
65 | public int Width { get { return m_terrainData.SizeX; } } // X dimension | ||
66 | // Unfortunately, for historical reasons, in this module 'Width' is X and 'Height' is Y | ||
67 | public int Height { get { return m_terrainData.SizeY; } } // Y dimension | ||
68 | public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension | ||
69 | |||
70 | >>>>>>> avn/ubitvar | ||
60 | // Default, not-often-used builder | 71 | // Default, not-often-used builder |
61 | public TerrainChannel() | 72 | public TerrainChannel() |
62 | { | 73 | { |
@@ -157,11 +168,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
157 | { | 168 | { |
158 | if (Double.IsNaN(value) || Double.IsInfinity(value)) | 169 | if (Double.IsNaN(value) || Double.IsInfinity(value)) |
159 | return; | 170 | return; |
171 | <<<<<<< HEAD | ||
172 | |||
173 | ======= | ||
160 | if (value < 0) | 174 | if (value < 0) |
161 | value = 0; | 175 | value = 0; |
162 | else | 176 | else |
163 | if (value > 655.35) | 177 | if (value > 655.35) |
164 | value = 655.35; | 178 | value = 655.35; |
179 | >>>>>>> avn/ubitvar | ||
165 | m_terrainData[x, y] = (float)value; | 180 | m_terrainData[x, y] = (float)value; |
166 | } | 181 | } |
167 | } | 182 | } |
@@ -367,8 +382,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | public int SizeY; | 382 | public int SizeY; |
368 | public int SizeZ; | 383 | public int SizeZ; |
369 | public float CompressionFactor; | 384 | public float CompressionFactor; |
385 | <<<<<<< HEAD | ||
386 | public int[] Map; | ||
387 | public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, int[] pMap) | ||
388 | ======= | ||
370 | public float[] Map; | 389 | public float[] Map; |
371 | public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap) | 390 | public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap) |
391 | >>>>>>> avn/ubitvar | ||
372 | { | 392 | { |
373 | Version = 1; | 393 | Version = 1; |
374 | SizeX = pX; | 394 | SizeX = pX; |
@@ -399,13 +419,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | // Fill the heightmap with the center bump terrain | 419 | // Fill the heightmap with the center bump terrain |
400 | private void PinHeadIsland() | 420 | private void PinHeadIsland() |
401 | { | 421 | { |
422 | <<<<<<< HEAD | ||
423 | ======= | ||
402 | float cx = m_terrainData.SizeX * 0.5f; | 424 | float cx = m_terrainData.SizeX * 0.5f; |
403 | float cy = m_terrainData.SizeY * 0.5f; | 425 | float cy = m_terrainData.SizeY * 0.5f; |
404 | float h; | 426 | float h; |
427 | >>>>>>> avn/ubitvar | ||
405 | for (int x = 0; x < Width; x++) | 428 | for (int x = 0; x < Width; x++) |
406 | { | 429 | { |
407 | for (int y = 0; y < Height; y++) | 430 | for (int y = 0; y < Height; y++) |
408 | { | 431 | { |
432 | <<<<<<< HEAD | ||
433 | m_terrainData[x, y] = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; | ||
434 | float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 50) * 0.01d); | ||
435 | float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 100) * 0.001d); | ||
436 | if (m_terrainData[x, y]< spherFacA) | ||
437 | m_terrainData[x, y]= spherFacA; | ||
438 | if (m_terrainData[x, y]< spherFacB) | ||
439 | m_terrainData[x, y] = spherFacB; | ||
440 | ======= | ||
409 | // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; | 441 | // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; |
410 | h = 1.0f; | 442 | h = 1.0f; |
411 | float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d); | 443 | float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d); |
@@ -415,6 +447,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
415 | if (h < spherFacB) | 447 | if (h < spherFacB) |
416 | h = spherFacB; | 448 | h = spherFacB; |
417 | m_terrainData[x, y] = h; | 449 | m_terrainData[x, y] = h; |
450 | >>>>>>> avn/ubitvar | ||
418 | } | 451 | } |
419 | } | 452 | } |
420 | } | 453 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 575a081..b6b3344 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 39 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 40 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs index 2d831fa..6118004 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs | |||
@@ -36,7 +36,6 @@ using OpenSim.Framework.Communications; | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | ||
40 | 39 | ||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace OpenSim.Region.Framework.Scenes.Tests |
42 | { | 41 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index a07d64c..bdf0700 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework.Communications; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Mock; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs new file mode 100644 index 0000000..1d41d33 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs | |||
@@ -0,0 +1,347 @@ | |||
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 System.Reflection; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
37 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
39 | using OpenSim.Region.CoreModules.World.Permissions; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | using OpenSim.Tests.Common; | ||
43 | |||
44 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// Test copying of scene objects. | ||
48 | /// </summary> | ||
49 | /// <remarks> | ||
50 | /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. | ||
51 | /// </remarks> | ||
52 | [TestFixture] | ||
53 | public class SceneObjectCopyTests : OpenSimTestCase | ||
54 | { | ||
55 | [TestFixtureSetUp] | ||
56 | public void FixtureInit() | ||
57 | { | ||
58 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
59 | // This facility was added after the original async delete tests were written, so it may be possible now | ||
60 | // to not bother explicitly disabling their async (since everything will be running sync). | ||
61 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
62 | } | ||
63 | |||
64 | [TestFixtureTearDown] | ||
65 | public void TearDown() | ||
66 | { | ||
67 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
68 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
69 | // tests really shouldn't). | ||
70 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
71 | } | ||
72 | |||
73 | [Test] | ||
74 | public void TestTakeCopyWhenCopierIsOwnerWithPerms() | ||
75 | { | ||
76 | TestHelpers.InMethod(); | ||
77 | // TestHelpers.EnableLogging(); | ||
78 | |||
79 | IConfigSource config = new IniConfigSource(); | ||
80 | config.AddConfig("Modules"); | ||
81 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
82 | |||
83 | TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config); | ||
84 | SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule()); | ||
85 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1)); | ||
86 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient; | ||
87 | |||
88 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
89 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
90 | sogd.Enabled = false; | ||
91 | |||
92 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID); | ||
93 | uint soLocalId = so.LocalId; | ||
94 | // so.UpdatePermissions( | ||
95 | // ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1); | ||
96 | // so.UpdatePermissions( | ||
97 | // ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0); | ||
98 | // so.UpdatePermissions( | ||
99 | // ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0); | ||
100 | // scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0); | ||
101 | |||
102 | // Ideally we might change these via client-focussed method calls as commented out above. However, this | ||
103 | // becomes very convoluted so we will set only the copy perm directly. | ||
104 | so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
105 | // so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
106 | |||
107 | List<uint> localIds = new List<uint>(); | ||
108 | localIds.Add(so.LocalId); | ||
109 | |||
110 | // Specifying a UUID.Zero in this case will currently plop it in Lost and Found | ||
111 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
112 | |||
113 | // Check that object isn't copied until we crank the sogd handle. | ||
114 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
115 | Assert.That(retrievedPart, Is.Not.Null); | ||
116 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
117 | |||
118 | sogd.InventoryDeQueueAndDelete(); | ||
119 | |||
120 | // Check that object is still there. | ||
121 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
122 | Assert.That(retrievedPart2, Is.Not.Null); | ||
123 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
124 | |||
125 | // Check that we have a copy in inventory | ||
126 | InventoryItemBase item | ||
127 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1"); | ||
128 | Assert.That(item, Is.Not.Null); | ||
129 | } | ||
130 | |||
131 | [Test] | ||
132 | public void TestTakeCopyWhenCopierIsOwnerWithoutPerms() | ||
133 | { | ||
134 | TestHelpers.InMethod(); | ||
135 | // TestHelpers.EnableLogging(); | ||
136 | |||
137 | IConfigSource config = new IniConfigSource(); | ||
138 | config.AddConfig("Modules"); | ||
139 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
140 | |||
141 | TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config); | ||
142 | SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule()); | ||
143 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1)); | ||
144 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient; | ||
145 | |||
146 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
147 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
148 | sogd.Enabled = false; | ||
149 | |||
150 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID); | ||
151 | uint soLocalId = so.LocalId; | ||
152 | |||
153 | so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy); | ||
154 | //so.RootPart.OwnerMask = (uint)(OpenMetaverse.PermissionMask.Copy & ~OpenMetaverse.PermissionMask.Copy); | ||
155 | |||
156 | List<uint> localIds = new List<uint>(); | ||
157 | localIds.Add(so.LocalId); | ||
158 | |||
159 | // Specifying a UUID.Zero in this case will currently plop it in Lost and Found | ||
160 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
161 | |||
162 | // Check that object isn't copied until we crank the sogd handle. | ||
163 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
164 | Assert.That(retrievedPart, Is.Not.Null); | ||
165 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
166 | |||
167 | sogd.InventoryDeQueueAndDelete(); | ||
168 | |||
169 | // Check that object is still there. | ||
170 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
171 | Assert.That(retrievedPart2, Is.Not.Null); | ||
172 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
173 | |||
174 | // Check that we do not have a copy in inventory | ||
175 | InventoryItemBase item | ||
176 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1"); | ||
177 | Assert.That(item, Is.Null); | ||
178 | } | ||
179 | |||
180 | [Test] | ||
181 | public void TestTakeCopyWhenCopierIsNotOwnerWithPerms() | ||
182 | { | ||
183 | TestHelpers.InMethod(); | ||
184 | // TestHelpers.EnableLogging(); | ||
185 | |||
186 | IConfigSource config = new IniConfigSource(); | ||
187 | config.AddConfig("Modules"); | ||
188 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
189 | |||
190 | TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config); | ||
191 | SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule()); | ||
192 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1)); | ||
193 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient; | ||
194 | |||
195 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
196 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
197 | sogd.Enabled = false; | ||
198 | |||
199 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2)); | ||
200 | uint soLocalId = so.LocalId; | ||
201 | |||
202 | // Base must allow transfer and copy | ||
203 | so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer); | ||
204 | // Must be set so anyone can copy | ||
205 | so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
206 | |||
207 | List<uint> localIds = new List<uint>(); | ||
208 | localIds.Add(so.LocalId); | ||
209 | |||
210 | // Specifying a UUID.Zero in this case will plop it in the Objects folder | ||
211 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
212 | |||
213 | // Check that object isn't copied until we crank the sogd handle. | ||
214 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
215 | Assert.That(retrievedPart, Is.Not.Null); | ||
216 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
217 | |||
218 | sogd.InventoryDeQueueAndDelete(); | ||
219 | |||
220 | // Check that object is still there. | ||
221 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
222 | Assert.That(retrievedPart2, Is.Not.Null); | ||
223 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
224 | |||
225 | // Check that we have a copy in inventory | ||
226 | InventoryItemBase item | ||
227 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); | ||
228 | Assert.That(item, Is.Not.Null); | ||
229 | } | ||
230 | |||
231 | [Test] | ||
232 | public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms() | ||
233 | { | ||
234 | TestHelpers.InMethod(); | ||
235 | // TestHelpers.EnableLogging(); | ||
236 | |||
237 | IConfigSource config = new IniConfigSource(); | ||
238 | config.AddConfig("Modules"); | ||
239 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
240 | |||
241 | TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config); | ||
242 | SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule()); | ||
243 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1)); | ||
244 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient; | ||
245 | |||
246 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
247 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
248 | sogd.Enabled = false; | ||
249 | |||
250 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2)); | ||
251 | uint soLocalId = so.LocalId; | ||
252 | |||
253 | { | ||
254 | // Check that object is not copied if copy base perms is missing. | ||
255 | // Should not allow copy if base does not have this. | ||
256 | so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer; | ||
257 | // Must be set so anyone can copy | ||
258 | so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
259 | |||
260 | // Check that object is not copied | ||
261 | List<uint> localIds = new List<uint>(); | ||
262 | localIds.Add(so.LocalId); | ||
263 | |||
264 | // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms | ||
265 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
266 | |||
267 | // Check that object isn't copied until we crank the sogd handle. | ||
268 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
269 | Assert.That(retrievedPart, Is.Not.Null); | ||
270 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
271 | |||
272 | sogd.InventoryDeQueueAndDelete(); | ||
273 | // Check that object is still there. | ||
274 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
275 | Assert.That(retrievedPart2, Is.Not.Null); | ||
276 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
277 | |||
278 | // Check that we have a copy in inventory | ||
279 | InventoryItemBase item | ||
280 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); | ||
281 | Assert.That(item, Is.Null); | ||
282 | } | ||
283 | |||
284 | { | ||
285 | // Check that object is not copied if copy trans perms is missing. | ||
286 | // Should not allow copy if base does not have this. | ||
287 | so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
288 | // Must be set so anyone can copy | ||
289 | so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy; | ||
290 | |||
291 | // Check that object is not copied | ||
292 | List<uint> localIds = new List<uint>(); | ||
293 | localIds.Add(so.LocalId); | ||
294 | |||
295 | // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms | ||
296 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
297 | |||
298 | // Check that object isn't copied until we crank the sogd handle. | ||
299 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
300 | Assert.That(retrievedPart, Is.Not.Null); | ||
301 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
302 | |||
303 | sogd.InventoryDeQueueAndDelete(); | ||
304 | // Check that object is still there. | ||
305 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
306 | Assert.That(retrievedPart2, Is.Not.Null); | ||
307 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
308 | |||
309 | // Check that we have a copy in inventory | ||
310 | InventoryItemBase item | ||
311 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); | ||
312 | Assert.That(item, Is.Null); | ||
313 | } | ||
314 | |||
315 | { | ||
316 | // Check that object is not copied if everyone copy perms is missing. | ||
317 | // Should not allow copy if base does not have this. | ||
318 | so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer); | ||
319 | // Make sure everyone perm does not allow copy | ||
320 | so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy); | ||
321 | |||
322 | // Check that object is not copied | ||
323 | List<uint> localIds = new List<uint>(); | ||
324 | localIds.Add(so.LocalId); | ||
325 | |||
326 | // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms | ||
327 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero); | ||
328 | |||
329 | // Check that object isn't copied until we crank the sogd handle. | ||
330 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
331 | Assert.That(retrievedPart, Is.Not.Null); | ||
332 | Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); | ||
333 | |||
334 | sogd.InventoryDeQueueAndDelete(); | ||
335 | // Check that object is still there. | ||
336 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
337 | Assert.That(retrievedPart2, Is.Not.Null); | ||
338 | Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); | ||
339 | |||
340 | // Check that we have a copy in inventory | ||
341 | InventoryItemBase item | ||
342 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); | ||
343 | Assert.That(item, Is.Null); | ||
344 | } | ||
345 | } | ||
346 | } | ||
347 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs new file mode 100644 index 0000000..5635c20 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |||
@@ -0,0 +1,259 @@ | |||
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 Nini.Config; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.CoreModules.Framework; | ||
35 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
37 | using OpenSim.Region.CoreModules.World.Land; | ||
38 | using OpenSim.Region.OptionalModules; | ||
39 | using OpenSim.Tests.Common; | ||
40 | |||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
42 | { | ||
43 | public class SceneObjectCrossingTests : OpenSimTestCase | ||
44 | { | ||
45 | [TestFixtureSetUp] | ||
46 | public void FixtureInit() | ||
47 | { | ||
48 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
49 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
50 | } | ||
51 | |||
52 | [TestFixtureTearDown] | ||
53 | public void TearDown() | ||
54 | { | ||
55 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
56 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
57 | // tests really shouldn't). | ||
58 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Test cross with no prim limit module. | ||
63 | /// </summary> | ||
64 | [Test] | ||
65 | public void TestCrossOnSameSimulator() | ||
66 | { | ||
67 | TestHelpers.InMethod(); | ||
68 | // TestHelpers.EnableLogging(); | ||
69 | |||
70 | UUID userId = TestHelpers.ParseTail(0x1); | ||
71 | int sceneObjectIdTail = 0x2; | ||
72 | |||
73 | EntityTransferModule etmA = new EntityTransferModule(); | ||
74 | EntityTransferModule etmB = new EntityTransferModule(); | ||
75 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
76 | |||
77 | IConfigSource config = new IniConfigSource(); | ||
78 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
79 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
80 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
81 | |||
82 | SceneHelpers sh = new SceneHelpers(); | ||
83 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
84 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
85 | |||
86 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
87 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
88 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
89 | |||
90 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
91 | UUID so1Id = so1.UUID; | ||
92 | so1.AbsolutePosition = new Vector3(128, 10, 20); | ||
93 | |||
94 | // Cross with a negative value | ||
95 | so1.AbsolutePosition = new Vector3(128, -10, 20); | ||
96 | |||
97 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); | ||
98 | Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Test cross with no prim limit module. | ||
103 | /// </summary> | ||
104 | /// <remarks> | ||
105 | /// Possibly this should belong in ScenePresenceCrossingTests, though here it is the object that is being moved | ||
106 | /// where the avatar is just a passenger. | ||
107 | /// </remarks> | ||
108 | [Test] | ||
109 | public void TestCrossOnSameSimulatorWithSittingAvatar() | ||
110 | { | ||
111 | TestHelpers.InMethod(); | ||
112 | // TestHelpers.EnableLogging(); | ||
113 | |||
114 | UUID userId = TestHelpers.ParseTail(0x1); | ||
115 | int sceneObjectIdTail = 0x2; | ||
116 | Vector3 so1StartPos = new Vector3(128, 10, 20); | ||
117 | |||
118 | EntityTransferModule etmA = new EntityTransferModule(); | ||
119 | EntityTransferModule etmB = new EntityTransferModule(); | ||
120 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
121 | |||
122 | IConfigSource config = new IniConfigSource(); | ||
123 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
124 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
125 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
126 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
127 | |||
128 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
129 | // for a callback from the destination scene before removing its avatar data. | ||
130 | entityTransferConfig.Set("wait_for_callback", false); | ||
131 | |||
132 | SceneHelpers sh = new SceneHelpers(); | ||
133 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
134 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
135 | |||
136 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
137 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); | ||
138 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | ||
139 | |||
140 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
141 | UUID so1Id = so1.UUID; | ||
142 | so1.AbsolutePosition = so1StartPos; | ||
143 | |||
144 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
145 | TestClient tc = new TestClient(acd, sceneA); | ||
146 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
147 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
148 | |||
149 | ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
150 | sp1SceneA.AbsolutePosition = so1StartPos; | ||
151 | sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); | ||
152 | |||
153 | // Cross | ||
154 | sceneA.SceneGraph.UpdatePrimGroupPosition( | ||
155 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId); | ||
156 | |||
157 | SceneObjectGroup so1PostCross; | ||
158 | |||
159 | { | ||
160 | ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); | ||
161 | Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); | ||
162 | |||
163 | ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); | ||
164 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); | ||
165 | sceneBTc.CompleteMovement(); | ||
166 | |||
167 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | ||
168 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); | ||
169 | |||
170 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); | ||
171 | so1PostCross = sceneB.GetSceneObjectGroup(so1Id); | ||
172 | Assert.NotNull(so1PostCross); | ||
173 | Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); | ||
174 | } | ||
175 | |||
176 | Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; | ||
177 | |||
178 | // Console.WriteLine("CRISSCROSS"); | ||
179 | |||
180 | // Recross | ||
181 | sceneB.SceneGraph.UpdatePrimGroupPosition( | ||
182 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId); | ||
183 | |||
184 | { | ||
185 | ScenePresence sp1SceneBPostReCross = sceneB.GetScenePresence(userId); | ||
186 | Assert.IsTrue(sp1SceneBPostReCross.IsChildAgent, "sp1SceneBPostReCross.IsChildAgent unexpectedly false"); | ||
187 | |||
188 | ScenePresence sp1SceneAPostReCross = sceneA.GetScenePresence(userId); | ||
189 | TestClient sceneATc = ((TestClient)sp1SceneAPostReCross.ControllingClient); | ||
190 | sceneATc.CompleteMovement(); | ||
191 | |||
192 | Assert.IsFalse(sp1SceneAPostReCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | ||
193 | Assert.IsTrue(sp1SceneAPostReCross.IsSatOnObject); | ||
194 | |||
195 | Assert.IsNull(sceneB.GetSceneObjectGroup(so1Id), "uck2"); | ||
196 | SceneObjectGroup so1PostReCross = sceneA.GetSceneObjectGroup(so1Id); | ||
197 | Assert.NotNull(so1PostReCross); | ||
198 | Assert.AreEqual(1, so1PostReCross.GetSittingAvatarsCount()); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | /// <summary> | ||
203 | /// Test cross with no prim limit module. | ||
204 | /// </summary> | ||
205 | /// <remarks> | ||
206 | /// XXX: This test may FCbe better off in a specific PrimLimitsModuleTest class in optional module tests in the | ||
207 | /// future (though it is configured as active by default, so not really optional). | ||
208 | /// </remarks> | ||
209 | [Test] | ||
210 | public void TestCrossOnSameSimulatorPrimLimitsOkay() | ||
211 | { | ||
212 | TestHelpers.InMethod(); | ||
213 | // TestHelpers.EnableLogging(); | ||
214 | |||
215 | UUID userId = TestHelpers.ParseTail(0x1); | ||
216 | int sceneObjectIdTail = 0x2; | ||
217 | |||
218 | EntityTransferModule etmA = new EntityTransferModule(); | ||
219 | EntityTransferModule etmB = new EntityTransferModule(); | ||
220 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
221 | LandManagementModule lmmA = new LandManagementModule(); | ||
222 | LandManagementModule lmmB = new LandManagementModule(); | ||
223 | |||
224 | IConfigSource config = new IniConfigSource(); | ||
225 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
226 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
227 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
228 | |||
229 | IConfig permissionsConfig = config.AddConfig("Permissions"); | ||
230 | permissionsConfig.Set("permissionmodules", "PrimLimitsModule"); | ||
231 | |||
232 | SceneHelpers sh = new SceneHelpers(); | ||
233 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
234 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
235 | |||
236 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
237 | SceneHelpers.SetupSceneModules( | ||
238 | sceneA, config, etmA, lmmA, new PrimLimitsModule(), new PrimCountModule()); | ||
239 | SceneHelpers.SetupSceneModules( | ||
240 | sceneB, config, etmB, lmmB, new PrimLimitsModule(), new PrimCountModule()); | ||
241 | |||
242 | // We must set up the parcel for this to work. Normally this is taken care of by OpenSimulator startup | ||
243 | // code which is not yet easily invoked by tests. | ||
244 | lmmA.EventManagerOnNoLandDataFromStorage(); | ||
245 | lmmB.EventManagerOnNoLandDataFromStorage(); | ||
246 | |||
247 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
248 | UUID so1Id = so1.UUID; | ||
249 | so1.AbsolutePosition = new Vector3(128, 10, 20); | ||
250 | |||
251 | // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly | ||
252 | // because only this will execute permission checks in the source region. | ||
253 | sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId); | ||
254 | |||
255 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); | ||
256 | Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); | ||
257 | } | ||
258 | } | ||
259 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 95b30d5..b7e9499 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.World.Permissions; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Mock; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.Framework.Scenes.Tests | 44 | namespace OpenSim.Region.Framework.Scenes.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 9378e20..c2e0ae3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | ||
38 | using log4net; | 37 | using log4net; |
39 | 38 | ||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 39 | namespace OpenSim.Region.Framework.Scenes.Tests |
@@ -91,7 +90,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
91 | grp2.RootPart.ClearUpdateSchedule(); | 90 | grp2.RootPart.ClearUpdateSchedule(); |
92 | 91 | ||
93 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. | 92 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. |
93 | Assert.IsFalse(grp1.GroupContainsForeignPrims); | ||
94 | grp1.LinkToGroup(grp2); | 94 | grp1.LinkToGroup(grp2); |
95 | Assert.IsTrue(grp1.GroupContainsForeignPrims); | ||
96 | |||
97 | scene.Backup(true); | ||
98 | Assert.IsFalse(grp1.GroupContainsForeignPrims); | ||
95 | 99 | ||
96 | // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since | 100 | // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since |
97 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. | 101 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. |
@@ -143,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
143 | 147 | ||
144 | Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); | 148 | Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); |
145 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); | 149 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); |
146 | Assert.That(grp3.HasGroupChangedDueToDelink, Is.True); | 150 | Assert.NotNull(grp3); |
147 | } | 151 | } |
148 | 152 | ||
149 | [Test] | 153 | [Test] |
@@ -335,30 +339,34 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
335 | SceneObjectPart rootPart | 339 | SceneObjectPart rootPart |
336 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 340 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
337 | { Name = rootPartName, UUID = rootPartUuid }; | 341 | { Name = rootPartName, UUID = rootPartUuid }; |
342 | |||
338 | SceneObjectPart linkPart | 343 | SceneObjectPart linkPart |
339 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 344 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
340 | { Name = linkPartName, UUID = linkPartUuid }; | 345 | { Name = linkPartName, UUID = linkPartUuid }; |
346 | SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart); | ||
347 | scene.AddNewSceneObject(linkGroup, true); | ||
341 | 348 | ||
342 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | 349 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); |
343 | sog.AddPart(linkPart); | 350 | scene.AddNewSceneObject(sog, true); |
344 | scene.AddNewSceneObject(sog, true); | 351 | |
345 | 352 | Assert.IsFalse(sog.GroupContainsForeignPrims); | |
346 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | 353 | sog.LinkToGroup(linkGroup); |
347 | // scene backup thread. | 354 | Assert.IsTrue(sog.GroupContainsForeignPrims); |
355 | |||
348 | scene.Backup(true); | 356 | scene.Backup(true); |
349 | 357 | Assert.AreEqual(1, scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID).Count); | |
358 | |||
350 | // These changes should occur immediately without waiting for a backup pass | 359 | // These changes should occur immediately without waiting for a backup pass |
351 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | 360 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); |
352 | 361 | Assert.IsFalse(groupToDelete.GroupContainsForeignPrims); | |
353 | Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True); | 362 | |
354 | scene.DeleteSceneObject(groupToDelete, false); | 363 | scene.DeleteSceneObject(groupToDelete, false); |
355 | Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False); | ||
356 | 364 | ||
357 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); | 365 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
358 | 366 | ||
359 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | 367 | Assert.AreEqual(1, storedObjects.Count); |
360 | Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1)); | 368 | Assert.AreEqual(1, storedObjects[0].Parts.Length); |
361 | Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); | 369 | Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid)); |
362 | } | 370 | } |
363 | } | 371 | } |
364 | } | 372 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 1182c96..ce7fc0e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -33,7 +33,6 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Framework.Communications; | 33 | using OpenSim.Framework.Communications; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | ||
37 | 36 | ||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | 37 | namespace OpenSim.Region.Framework.Scenes.Tests |
39 | { | 38 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index a58e735..fdbe7ae 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs | |||
@@ -35,7 +35,6 @@ using OpenSim.Framework.Communications; | |||
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 39 | namespace OpenSim.Region.Framework.Scenes.Tests |
41 | { | 40 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs new file mode 100644 index 0000000..927d8e8 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs | |||
@@ -0,0 +1,136 @@ | |||
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 System.Reflection; | ||
31 | using System.Threading; | ||
32 | using System.Xml; | ||
33 | using System.Linq; | ||
34 | using Nini.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
42 | using OpenSim.Services.Interfaces; | ||
43 | using OpenSim.Tests.Common; | ||
44 | |||
45 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// Basic scene object serialization tests. | ||
49 | /// </summary> | ||
50 | [TestFixture] | ||
51 | public class SceneObjectSerializationTests : OpenSimTestCase | ||
52 | { | ||
53 | |||
54 | /// <summary> | ||
55 | /// Serialize and deserialize. | ||
56 | /// </summary> | ||
57 | [Test] | ||
58 | public void TestSerialDeserial() | ||
59 | { | ||
60 | TestHelpers.InMethod(); | ||
61 | |||
62 | Scene scene = new SceneHelpers().SetupScene(); | ||
63 | int partsToTestCount = 3; | ||
64 | |||
65 | SceneObjectGroup so | ||
66 | = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10); | ||
67 | SceneObjectPart[] parts = so.Parts; | ||
68 | so.Name = "obj1"; | ||
69 | so.Description = "xpto"; | ||
70 | |||
71 | string xml = SceneObjectSerializer.ToXml2Format(so); | ||
72 | Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string"); | ||
73 | |||
74 | XmlDocument doc = new XmlDocument(); | ||
75 | doc.LoadXml(xml); | ||
76 | XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart"); | ||
77 | Assert.That(nodes.Count, Is.EqualTo(3), "SOG serialization resulted in wrong number of SOPs"); | ||
78 | |||
79 | SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml); | ||
80 | Assert.IsNotNull(so2, "SOG deserialization resulted in null object"); | ||
81 | Assert.That(so2.Name == so.Name, "Name of deserialized object does not match original name"); | ||
82 | Assert.That(so2.Description == so.Description, "Description of deserialized object does not match original name"); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// This checks for a bug reported in mantis #7514 | ||
87 | /// </summary> | ||
88 | [Test] | ||
89 | public void TestNamespaceAttribute() | ||
90 | { | ||
91 | TestHelpers.InMethod(); | ||
92 | |||
93 | Scene scene = new SceneHelpers().SetupScene(); | ||
94 | UserAccount account = new UserAccount(UUID.Zero, UUID.Random(), "Test", "User", string.Empty); | ||
95 | scene.UserAccountService.StoreUserAccount(account); | ||
96 | int partsToTestCount = 1; | ||
97 | |||
98 | SceneObjectGroup so | ||
99 | = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10); | ||
100 | SceneObjectPart[] parts = so.Parts; | ||
101 | so.Name = "obj1"; | ||
102 | so.Description = "xpto"; | ||
103 | so.OwnerID = account.PrincipalID; | ||
104 | so.RootPart.CreatorID = so.OwnerID; | ||
105 | |||
106 | string xml = SceneObjectSerializer.ToXml2Format(so); | ||
107 | Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string"); | ||
108 | |||
109 | xml = ExternalRepresentationUtils.RewriteSOP(xml, "Test Scene", "http://localhost", scene.UserAccountService, UUID.Zero); | ||
110 | //Console.WriteLine(xml); | ||
111 | |||
112 | XmlDocument doc = new XmlDocument(); | ||
113 | doc.LoadXml(xml); | ||
114 | |||
115 | XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart"); | ||
116 | Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no SOPs"); | ||
117 | foreach (XmlAttribute a in nodes[0].Attributes) | ||
118 | { | ||
119 | int count = a.Name.Count(c => c == ':'); | ||
120 | Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in SOP"); | ||
121 | } | ||
122 | nodes = doc.GetElementsByTagName("CreatorData"); | ||
123 | Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no CreatorData"); | ||
124 | foreach (XmlAttribute a in nodes[0].Attributes) | ||
125 | { | ||
126 | int count = a.Name.Count(c => c == ':'); | ||
127 | Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in CreatorData"); | ||
128 | } | ||
129 | |||
130 | SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml); | ||
131 | Assert.IsNotNull(so2, "SOG deserialization resulted in null object"); | ||
132 | Assert.AreNotEqual(so.RootPart.CreatorIdentification, so2.RootPart.CreatorIdentification, "RewriteSOP failed to transform CreatorData."); | ||
133 | Assert.That(so2.RootPart.CreatorIdentification.Contains("http://"), "RewriteSOP failed to add the homeURL to CreatorData"); | ||
134 | } | ||
135 | } | ||
136 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index abaa1d1..974529a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 8eb3191..5ba754c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
@@ -58,6 +57,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | } | 57 | } |
59 | 58 | ||
60 | [Test] | 59 | [Test] |
60 | public void TestSetTemporary() | ||
61 | { | ||
62 | TestHelpers.InMethod(); | ||
63 | |||
64 | m_scene.AddSceneObject(m_so1); | ||
65 | m_so1.ScriptSetTemporaryStatus(true); | ||
66 | |||
67 | // Is this really the correct flag? | ||
68 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.TemporaryOnRez)); | ||
69 | Assert.That(m_so1.Backup, Is.False); | ||
70 | |||
71 | // Test setting back to non-temporary | ||
72 | m_so1.ScriptSetTemporaryStatus(false); | ||
73 | |||
74 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
75 | Assert.That(m_so1.Backup, Is.True); | ||
76 | } | ||
77 | |||
78 | [Test] | ||
61 | public void TestSetPhantomSinglePrim() | 79 | public void TestSetPhantomSinglePrim() |
62 | { | 80 | { |
63 | TestHelpers.InMethod(); | 81 | TestHelpers.InMethod(); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs new file mode 100644 index 0000000..cdebe25 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs | |||
@@ -0,0 +1,183 @@ | |||
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 NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Tests.Common; | ||
36 | |||
37 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Tests for undo/redo | ||
41 | /// </summary> | ||
42 | public class SceneObjectUndoRedoTests : OpenSimTestCase | ||
43 | { | ||
44 | [Test] | ||
45 | public void TestUndoRedoResizeSceneObject() | ||
46 | { | ||
47 | TestHelpers.InMethod(); | ||
48 | // TestHelpers.EnableLogging(); | ||
49 | |||
50 | Vector3 firstSize = new Vector3(2, 3, 4); | ||
51 | Vector3 secondSize = new Vector3(5, 6, 7); | ||
52 | |||
53 | Scene scene = new SceneHelpers().SetupScene(); | ||
54 | scene.MaxUndoCount = 20; | ||
55 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | ||
56 | |||
57 | // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG, | ||
58 | // which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However, | ||
59 | // this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not | ||
60 | // in a scene. | ||
61 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
62 | |||
63 | g1.GroupResize(firstSize); | ||
64 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1)); | ||
65 | |||
66 | g1.GroupResize(secondSize); | ||
67 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2)); | ||
68 | |||
69 | g1.RootPart.Undo(); | ||
70 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1)); | ||
71 | Assert.That(g1.GroupScale, Is.EqualTo(firstSize)); | ||
72 | |||
73 | g1.RootPart.Redo(); | ||
74 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2)); | ||
75 | Assert.That(g1.GroupScale, Is.EqualTo(secondSize)); | ||
76 | } | ||
77 | |||
78 | [Test] | ||
79 | public void TestUndoLimit() | ||
80 | { | ||
81 | TestHelpers.InMethod(); | ||
82 | |||
83 | Vector3 firstSize = new Vector3(2, 3, 4); | ||
84 | Vector3 secondSize = new Vector3(5, 6, 7); | ||
85 | Vector3 thirdSize = new Vector3(8, 9, 10); | ||
86 | Vector3 fourthSize = new Vector3(11, 12, 13); | ||
87 | |||
88 | Scene scene = new SceneHelpers().SetupScene(); | ||
89 | scene.MaxUndoCount = 2; | ||
90 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | ||
91 | |||
92 | g1.GroupResize(firstSize); | ||
93 | g1.GroupResize(secondSize); | ||
94 | g1.GroupResize(thirdSize); | ||
95 | g1.GroupResize(fourthSize); | ||
96 | |||
97 | g1.RootPart.Undo(); | ||
98 | g1.RootPart.Undo(); | ||
99 | g1.RootPart.Undo(); | ||
100 | |||
101 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
102 | Assert.That(g1.GroupScale, Is.EqualTo(secondSize)); | ||
103 | } | ||
104 | |||
105 | [Test] | ||
106 | public void TestNoUndoOnObjectsNotInScene() | ||
107 | { | ||
108 | TestHelpers.InMethod(); | ||
109 | |||
110 | Vector3 firstSize = new Vector3(2, 3, 4); | ||
111 | Vector3 secondSize = new Vector3(5, 6, 7); | ||
112 | // Vector3 thirdSize = new Vector3(8, 9, 10); | ||
113 | // Vector3 fourthSize = new Vector3(11, 12, 13); | ||
114 | |||
115 | Scene scene = new SceneHelpers().SetupScene(); | ||
116 | scene.MaxUndoCount = 20; | ||
117 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); | ||
118 | |||
119 | g1.GroupResize(firstSize); | ||
120 | g1.GroupResize(secondSize); | ||
121 | |||
122 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
123 | |||
124 | g1.RootPart.Undo(); | ||
125 | |||
126 | Assert.That(g1.GroupScale, Is.EqualTo(secondSize)); | ||
127 | } | ||
128 | |||
129 | [Test] | ||
130 | public void TestUndoBeyondAvailable() | ||
131 | { | ||
132 | TestHelpers.InMethod(); | ||
133 | |||
134 | Vector3 newSize = new Vector3(2, 3, 4); | ||
135 | |||
136 | Scene scene = new SceneHelpers().SetupScene(); | ||
137 | scene.MaxUndoCount = 20; | ||
138 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | ||
139 | Vector3 originalSize = g1.GroupScale; | ||
140 | |||
141 | g1.RootPart.Undo(); | ||
142 | |||
143 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
144 | Assert.That(g1.GroupScale, Is.EqualTo(originalSize)); | ||
145 | |||
146 | g1.GroupResize(newSize); | ||
147 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1)); | ||
148 | Assert.That(g1.GroupScale, Is.EqualTo(newSize)); | ||
149 | |||
150 | g1.RootPart.Undo(); | ||
151 | g1.RootPart.Undo(); | ||
152 | |||
153 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
154 | Assert.That(g1.GroupScale, Is.EqualTo(originalSize)); | ||
155 | } | ||
156 | |||
157 | [Test] | ||
158 | public void TestRedoBeyondAvailable() | ||
159 | { | ||
160 | TestHelpers.InMethod(); | ||
161 | |||
162 | Vector3 newSize = new Vector3(2, 3, 4); | ||
163 | |||
164 | Scene scene = new SceneHelpers().SetupScene(); | ||
165 | scene.MaxUndoCount = 20; | ||
166 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | ||
167 | Vector3 originalSize = g1.GroupScale; | ||
168 | |||
169 | g1.RootPart.Redo(); | ||
170 | |||
171 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0)); | ||
172 | Assert.That(g1.GroupScale, Is.EqualTo(originalSize)); | ||
173 | |||
174 | g1.GroupResize(newSize); | ||
175 | g1.RootPart.Undo(); | ||
176 | g1.RootPart.Redo(); | ||
177 | g1.RootPart.Redo(); | ||
178 | |||
179 | Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1)); | ||
180 | Assert.That(g1.GroupScale, Is.EqualTo(newSize)); | ||
181 | } | ||
182 | } | ||
183 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index e7a1fe0..32d6649 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -39,7 +39,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; | 40 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; |
41 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | ||
43 | 42 | ||
44 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace OpenSim.Region.Framework.Scenes.Tests |
45 | { | 44 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 1ff1329..06e6423 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer; | |||
44 | using OpenSim.Region.CoreModules.World.Serialiser; | 44 | using OpenSim.Region.CoreModules.World.Serialiser; |
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
46 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
47 | using OpenSim.Tests.Common.Mock; | ||
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 47 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
49 | 48 | ||
50 | namespace OpenSim.Region.Framework.Scenes.Tests | 49 | namespace OpenSim.Region.Framework.Scenes.Tests |
@@ -228,7 +227,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
228 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and | 227 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and |
229 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** | 228 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** |
230 | // XXX: ViaLogin may not be correct here. | 229 | // XXX: ViaLogin may not be correct here. |
231 | scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); | 230 | scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason); |
232 | 231 | ||
233 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | 232 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); |
234 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | 233 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 1cd8ae9..42cfa1b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Region.Physics.Manager; | 44 | using OpenSim.Region.Physics.Manager; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index d80afd3..c6e3b8b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework.Communications; | |||
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Mock; | ||
41 | 40 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs index 9fa0a71..45bfbff 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs | |||
@@ -47,7 +47,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | |||
47 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
48 | using OpenSim.Region.Framework.Interfaces; | 48 | using OpenSim.Region.Framework.Interfaces; |
49 | using OpenSim.Tests.Common; | 49 | using OpenSim.Tests.Common; |
50 | using OpenSim.Tests.Common.Mock; | ||
51 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 50 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
52 | 51 | ||
53 | namespace OpenSim.Region.Framework.Scenes.Tests | 52 | namespace OpenSim.Region.Framework.Scenes.Tests |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index b806a97..c193a97 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs | |||
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer; | |||
40 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 40 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
41 | using OpenSim.Region.CoreModules.World.Permissions; | 41 | using OpenSim.Region.CoreModules.World.Permissions; |
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Mock; | ||
44 | 43 | ||
45 | namespace OpenSim.Region.Framework.Scenes.Tests | 44 | namespace OpenSim.Region.Framework.Scenes.Tests |
46 | { | 45 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 0911f00..b775178 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework.Servers; | |||
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Mock; | ||
41 | using System.Threading; | 40 | using System.Threading; |
42 | 41 | ||
43 | namespace OpenSim.Region.Framework.Scenes.Tests | 42 | namespace OpenSim.Region.Framework.Scenes.Tests |
@@ -73,6 +72,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
73 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); | 72 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); |
74 | Assert.That(part.GetSittingAvatars(), Is.Null); | 73 | Assert.That(part.GetSittingAvatars(), Is.Null); |
75 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); | 74 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); |
75 | Assert.AreEqual(startPos, m_sp.AbsolutePosition); | ||
76 | } | 76 | } |
77 | 77 | ||
78 | [Test] | 78 | [Test] |
@@ -87,15 +87,21 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
87 | 87 | ||
88 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; | 88 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
89 | 89 | ||
90 | // We need to preserve this here because phys actor is removed by the sit. | ||
91 | Vector3 spPhysActorSize = m_sp.PhysicsActor.Size; | ||
90 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 92 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
91 | 93 | ||
92 | Assert.That(m_sp.PhysicsActor, Is.Null); | 94 | Assert.That(m_sp.PhysicsActor, Is.Null); |
93 | 95 | ||
96 | Assert.That( | ||
97 | m_sp.AbsolutePosition, | ||
98 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2))); | ||
99 | |||
94 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 100 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
95 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | 101 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); |
96 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | 102 | HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); |
97 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | 103 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); |
98 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | 104 | Assert.That(sittingAvatars.Contains(m_sp)); |
99 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | 105 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); |
100 | } | 106 | } |
101 | 107 | ||
@@ -129,6 +135,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
129 | } | 135 | } |
130 | 136 | ||
131 | [Test] | 137 | [Test] |
138 | public void TestSitAndStandWithNoSitTargetChildPrim() | ||
139 | { | ||
140 | TestHelpers.InMethod(); | ||
141 | // log4net.Config.XmlConfigurator.Configure(); | ||
142 | |||
143 | // Make sure we're within range to sit | ||
144 | Vector3 startPos = new Vector3(1, 1, 1); | ||
145 | m_sp.AbsolutePosition = startPos; | ||
146 | |||
147 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene, 2, m_sp.UUID, "part", 0x10).Parts[1]; | ||
148 | part.OffsetPosition = new Vector3(2, 3, 4); | ||
149 | |||
150 | // We need to preserve this here because phys actor is removed by the sit. | ||
151 | Vector3 spPhysActorSize = m_sp.PhysicsActor.Size; | ||
152 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | ||
153 | |||
154 | Assert.That( | ||
155 | m_sp.AbsolutePosition, | ||
156 | Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2))); | ||
157 | |||
158 | m_sp.StandUp(); | ||
159 | |||
160 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | ||
161 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); | ||
162 | Assert.That(part.GetSittingAvatars(), Is.Null); | ||
163 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); | ||
164 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); | ||
165 | } | ||
166 | |||
167 | [Test] | ||
132 | public void TestSitAndStandWithSitTarget() | 168 | public void TestSitAndStandWithSitTarget() |
133 | { | 169 | { |
134 | TestHelpers.InMethod(); | 170 | TestHelpers.InMethod(); |
@@ -145,15 +181,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
145 | 181 | ||
146 | Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID)); | 182 | Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID)); |
147 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | 183 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); |
148 | // Assert.That( | 184 | |
149 | // m_sp.AbsolutePosition, | 185 | // This section is copied from ScenePresence.HandleAgentSit(). Correctness is not guaranteed. |
150 | // Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); | 186 | double x, y, z, m1, m2; |
187 | |||
188 | Quaternion r = part.SitTargetOrientation;; | ||
189 | m1 = r.X * r.X + r.Y * r.Y; | ||
190 | m2 = r.Z * r.Z + r.W * r.W; | ||
191 | |||
192 | // Rotate the vector <0, 0, 1> | ||
193 | x = 2 * (r.X * r.Z + r.Y * r.W); | ||
194 | y = 2 * (-r.X * r.W + r.Y * r.Z); | ||
195 | z = m2 - m1; | ||
196 | |||
197 | // Set m to be the square of the norm of r. | ||
198 | double m = m1 + m2; | ||
199 | |||
200 | // This constant is emperically determined to be what is used in SL. | ||
201 | // See also http://opensimulator.org/mantis/view.php?id=7096 | ||
202 | double offset = 0.05; | ||
203 | |||
204 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | ||
205 | Vector3 sitOffset = up * (float)offset; | ||
206 | // End of copied section. | ||
207 | |||
208 | Assert.That( | ||
209 | m_sp.AbsolutePosition, | ||
210 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition - sitOffset + ScenePresence.SIT_TARGET_ADJUSTMENT)); | ||
151 | Assert.That(m_sp.PhysicsActor, Is.Null); | 211 | Assert.That(m_sp.PhysicsActor, Is.Null); |
152 | 212 | ||
153 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | 213 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); |
154 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | 214 | HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); |
155 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | 215 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); |
156 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | 216 | Assert.That(sittingAvatars.Contains(m_sp)); |
157 | 217 | ||
158 | m_sp.StandUp(); | 218 | m_sp.StandUp(); |
159 | 219 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index fff542b..42276dd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer; | |||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Region.CoreModules.World.Permissions; | 44 | using OpenSim.Region.CoreModules.World.Permissions; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 48 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs index 1667002..2d36214 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs | |||
@@ -34,7 +34,6 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace OpenSim.Region.Framework.Scenes.Tests |
40 | { | 39 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs index 9a97acc..584a03c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs | |||
@@ -32,7 +32,6 @@ using OpenSim.Region.Framework.Scenes; | |||
32 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
34 | using OpenSim.Tests.Common; | 34 | using OpenSim.Tests.Common; |
35 | using OpenSim.Tests.Common.Mock; | ||
36 | 35 | ||
37 | namespace OpenSim.Region.Framework.Scenes.Tests | 36 | namespace OpenSim.Region.Framework.Scenes.Tests |
38 | { | 37 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 9d8eb0b..33ef83b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -42,7 +42,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | 42 | using OpenSim.Region.CoreModules.World.Serialiser; |
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
44 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | ||
46 | 45 | ||
47 | namespace OpenSim.Region.Framework.Scenes.Tests | 46 | namespace OpenSim.Region.Framework.Scenes.Tests |
48 | { | 47 | { |
@@ -52,6 +51,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | [TestFixture] | 51 | [TestFixture] |
53 | public class SceneTests : OpenSimTestCase | 52 | public class SceneTests : OpenSimTestCase |
54 | { | 53 | { |
54 | [Test] | ||
55 | public void TestCreateScene() | ||
56 | { | ||
57 | TestHelpers.InMethod(); | ||
58 | |||
59 | new SceneHelpers().SetupScene(); | ||
60 | } | ||
61 | |||
62 | [Test] | ||
63 | public void TestCreateVarScene() | ||
64 | { | ||
65 | TestHelpers.InMethod(); | ||
66 | UUID regionUuid = TestHelpers.ParseTail(0x1); | ||
67 | uint sizeX = 512; | ||
68 | uint sizeY = 512; | ||
69 | |||
70 | Scene scene | ||
71 | = new SceneHelpers().SetupScene("scene", regionUuid, 1000, 1000, sizeX, sizeY, new IniConfigSource()); | ||
72 | |||
73 | Assert.AreEqual(sizeX, scene.RegionInfo.RegionSizeX); | ||
74 | Assert.AreEqual(sizeY, scene.RegionInfo.RegionSizeY); | ||
75 | } | ||
76 | |||
55 | /// <summary> | 77 | /// <summary> |
56 | /// Very basic scene update test. Should become more elaborate with time. | 78 | /// Very basic scene update test. Should become more elaborate with time. |
57 | /// </summary> | 79 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs new file mode 100644 index 0000000..eeda84f --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs | |||
@@ -0,0 +1,249 @@ | |||
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 System.Net; | ||
31 | using Mono.Addins; | ||
32 | using Nini.Config; | ||
33 | using NUnit.Framework; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim; | ||
36 | using OpenSim.ApplicationPlugins.RegionModulesController; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Tests.Common; | ||
41 | |||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
43 | { | ||
44 | public class SharedRegionModuleTests : OpenSimTestCase | ||
45 | { | ||
46 | // [Test] | ||
47 | public void TestLifecycle() | ||
48 | { | ||
49 | TestHelpers.InMethod(); | ||
50 | TestHelpers.EnableLogging(); | ||
51 | |||
52 | UUID estateOwnerId = TestHelpers.ParseTail(0x1); | ||
53 | UUID regionId = TestHelpers.ParseTail(0x10); | ||
54 | |||
55 | IConfigSource configSource = new IniConfigSource(); | ||
56 | configSource.AddConfig("Startup"); | ||
57 | configSource.AddConfig("Modules"); | ||
58 | |||
59 | // // We use this to skip estate questions | ||
60 | // Turns out not to be needed is estate owner id is pre-set in region information. | ||
61 | // IConfig estateConfig = configSource.AddConfig(OpenSimBase.ESTATE_SECTION_NAME); | ||
62 | // estateConfig.Set("DefaultEstateOwnerName", "Zaphod Beeblebrox"); | ||
63 | // estateConfig.Set("DefaultEstateOwnerUUID", estateOwnerId); | ||
64 | // estateConfig.Set("DefaultEstateOwnerEMail", "zaphod@galaxy.com"); | ||
65 | // estateConfig.Set("DefaultEstateOwnerPassword", "two heads"); | ||
66 | |||
67 | // For grid servic | ||
68 | configSource.AddConfig("GridService"); | ||
69 | configSource.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | ||
70 | configSource.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); | ||
71 | configSource.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | ||
72 | configSource.Configs["GridService"].Set("ConnectionString", "!static"); | ||
73 | |||
74 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); | ||
75 | // | ||
76 | OpenSim sim = new OpenSim(configSource); | ||
77 | |||
78 | sim.SuppressExit = true; | ||
79 | sim.EnableInitialPluginLoad = false; | ||
80 | sim.LoadEstateDataService = false; | ||
81 | sim.NetServersInfo.HttpListenerPort = 0; | ||
82 | |||
83 | IRegistryCore reg = sim.ApplicationRegistry; | ||
84 | |||
85 | RegionInfo ri = new RegionInfo(); | ||
86 | ri.RegionID = regionId; | ||
87 | ri.EstateSettings.EstateOwner = estateOwnerId; | ||
88 | ri.InternalEndPoint = new IPEndPoint(0, 0); | ||
89 | |||
90 | MockRegionModulesControllerPlugin rmcp = new MockRegionModulesControllerPlugin(); | ||
91 | sim.m_plugins = new List<IApplicationPlugin>() { rmcp }; | ||
92 | reg.RegisterInterface<IRegionModulesController>(rmcp); | ||
93 | |||
94 | // XXX: Have to initialize directly for now | ||
95 | rmcp.Initialise(sim); | ||
96 | |||
97 | rmcp.AddNode(gridService); | ||
98 | |||
99 | TestSharedRegion tsr = new TestSharedRegion(); | ||
100 | rmcp.AddNode(tsr); | ||
101 | |||
102 | // FIXME: Want to use the real one eventually but this is currently directly tied into Mono.Addins | ||
103 | // which has been written in such a way that makes it impossible to use for regression tests. | ||
104 | // RegionModulesControllerPlugin rmcp = new RegionModulesControllerPlugin(); | ||
105 | // rmcp.LoadModulesFromAddins = false; | ||
106 | //// reg.RegisterInterface<IRegionModulesController>(rmcp); | ||
107 | // rmcp.Initialise(sim); | ||
108 | // rmcp.PostInitialise(); | ||
109 | // TypeExtensionNode node = new TypeExtensionNode(); | ||
110 | // node. | ||
111 | // rmcp.AddNode(node, configSource.Configs["Modules"], new Dictionary<RuntimeAddin, IList<int>>()); | ||
112 | |||
113 | sim.Startup(); | ||
114 | IScene scene; | ||
115 | sim.CreateRegion(ri, out scene); | ||
116 | |||
117 | sim.Shutdown(); | ||
118 | |||
119 | List<string> co = tsr.CallOrder; | ||
120 | int expectedEventCount = 6; | ||
121 | |||
122 | Assert.AreEqual( | ||
123 | expectedEventCount, | ||
124 | co.Count, | ||
125 | "Expected {0} events but only got {1} ({2})", | ||
126 | expectedEventCount, co.Count, string.Join(",", co)); | ||
127 | Assert.AreEqual("Initialise", co[0]); | ||
128 | Assert.AreEqual("PostInitialise", co[1]); | ||
129 | Assert.AreEqual("AddRegion", co[2]); | ||
130 | Assert.AreEqual("RegionLoaded", co[3]); | ||
131 | Assert.AreEqual("RemoveRegion", co[4]); | ||
132 | Assert.AreEqual("Close", co[5]); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | class TestSharedRegion : ISharedRegionModule | ||
137 | { | ||
138 | // FIXME: Should really use MethodInfo | ||
139 | public List<string> CallOrder = new List<string>(); | ||
140 | |||
141 | public string Name { get { return "TestSharedRegion"; } } | ||
142 | |||
143 | public Type ReplaceableInterface { get { return null; } } | ||
144 | |||
145 | public void PostInitialise() | ||
146 | { | ||
147 | CallOrder.Add("PostInitialise"); | ||
148 | } | ||
149 | |||
150 | public void Initialise(IConfigSource source) | ||
151 | { | ||
152 | CallOrder.Add("Initialise"); | ||
153 | } | ||
154 | |||
155 | public void Close() | ||
156 | { | ||
157 | CallOrder.Add("Close"); | ||
158 | } | ||
159 | |||
160 | public void AddRegion(Scene scene) | ||
161 | { | ||
162 | CallOrder.Add("AddRegion"); | ||
163 | } | ||
164 | |||
165 | public void RemoveRegion(Scene scene) | ||
166 | { | ||
167 | CallOrder.Add("RemoveRegion"); | ||
168 | } | ||
169 | |||
170 | public void RegionLoaded(Scene scene) | ||
171 | { | ||
172 | CallOrder.Add("RegionLoaded"); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | class MockRegionModulesControllerPlugin : IRegionModulesController, IApplicationPlugin | ||
177 | { | ||
178 | // List of shared module instances, for adding to Scenes | ||
179 | private List<ISharedRegionModule> m_sharedInstances = new List<ISharedRegionModule>(); | ||
180 | |||
181 | // Config access | ||
182 | private OpenSimBase m_openSim; | ||
183 | |||
184 | public string Version { get { return "0"; } } | ||
185 | public string Name { get { return "MockRegionModulesControllerPlugin"; } } | ||
186 | |||
187 | public void Initialise() {} | ||
188 | |||
189 | public void Initialise(OpenSimBase sim) | ||
190 | { | ||
191 | m_openSim = sim; | ||
192 | } | ||
193 | |||
194 | /// <summary> | ||
195 | /// Called when the application loading is completed | ||
196 | /// </summary> | ||
197 | public void PostInitialise() | ||
198 | { | ||
199 | foreach (ISharedRegionModule module in m_sharedInstances) | ||
200 | module.PostInitialise(); | ||
201 | } | ||
202 | |||
203 | public void AddRegionToModules(Scene scene) | ||
204 | { | ||
205 | List<ISharedRegionModule> sharedlist = new List<ISharedRegionModule>(); | ||
206 | |||
207 | foreach (ISharedRegionModule module in m_sharedInstances) | ||
208 | { | ||
209 | module.AddRegion(scene); | ||
210 | scene.AddRegionModule(module.Name, module); | ||
211 | |||
212 | sharedlist.Add(module); | ||
213 | } | ||
214 | |||
215 | foreach (ISharedRegionModule module in sharedlist) | ||
216 | { | ||
217 | module.RegionLoaded(scene); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public void RemoveRegionFromModules(Scene scene) | ||
222 | { | ||
223 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
224 | { | ||
225 | // m_log.DebugFormat("[REGIONMODULE]: Removing scene {0} from module {1}", | ||
226 | // scene.RegionInfo.RegionName, module.Name); | ||
227 | module.RemoveRegion(scene); | ||
228 | } | ||
229 | |||
230 | scene.RegionModules.Clear(); | ||
231 | } | ||
232 | |||
233 | public void AddNode(ISharedRegionModule module) | ||
234 | { | ||
235 | m_sharedInstances.Add(module); | ||
236 | module.Initialise(m_openSim.ConfigSource.Source); | ||
237 | } | ||
238 | |||
239 | public void Dispose() | ||
240 | { | ||
241 | // We expect that all regions have been removed already | ||
242 | while (m_sharedInstances.Count > 0) | ||
243 | { | ||
244 | m_sharedInstances[0].Close(); | ||
245 | m_sharedInstances.RemoveAt(0); | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 020bb6c..3caea8b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -45,7 +45,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
46 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | ||
49 | 48 | ||
50 | namespace OpenSim.Region.Framework.Tests | 49 | namespace OpenSim.Region.Framework.Tests |
51 | { | 50 | { |
@@ -65,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests | |||
65 | 64 | ||
66 | // Create an object embedded inside the first | 65 | // Create an object embedded inside the first |
67 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 66 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
68 | TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); | 67 | TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); |
69 | 68 | ||
70 | TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); | 69 | TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); |
71 | Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); | 70 | Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); |
@@ -89,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests | |||
89 | // Create an object embedded inside the first | 88 | // Create an object embedded inside the first |
90 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 89 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
91 | TaskInventoryItem taskSceneObjectItem | 90 | TaskInventoryItem taskSceneObjectItem |
92 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); | 91 | = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); |
93 | 92 | ||
94 | scene.AddSceneObject(sog1); | 93 | scene.AddSceneObject(sog1); |
95 | 94 | ||
@@ -130,13 +129,14 @@ namespace OpenSim.Region.Framework.Tests | |||
130 | SceneObjectPart sop1 = sog1.RootPart; | 129 | SceneObjectPart sop1 = sog1.RootPart; |
131 | TaskInventoryItem sopItem1 | 130 | TaskInventoryItem sopItem1 |
132 | = TaskInventoryHelpers.AddNotecard( | 131 | = TaskInventoryHelpers.AddNotecard( |
133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 132 | scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
134 | 133 | ||
135 | InventoryFolderBase folder | 134 | InventoryFolderBase folder |
136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 135 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
137 | 136 | ||
138 | // Perform test | 137 | // Perform test |
139 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); | 138 | string message; |
139 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message); | ||
140 | 140 | ||
141 | InventoryItemBase ncUserItem | 141 | InventoryItemBase ncUserItem |
142 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); | 142 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); |
@@ -162,10 +162,11 @@ namespace OpenSim.Region.Framework.Tests | |||
162 | SceneObjectPart sop1 = sog1.RootPart; | 162 | SceneObjectPart sop1 = sog1.RootPart; |
163 | TaskInventoryItem sopItem1 | 163 | TaskInventoryItem sopItem1 |
164 | = TaskInventoryHelpers.AddNotecard( | 164 | = TaskInventoryHelpers.AddNotecard( |
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 165 | scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
166 | 166 | ||
167 | // Perform test | 167 | // Perform test |
168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 168 | string message; |
169 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message); | ||
169 | 170 | ||
170 | InventoryItemBase ncUserItem | 171 | InventoryItemBase ncUserItem |
171 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); | 172 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index e50b4da..edc0a52 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -45,7 +45,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
46 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | ||
49 | 48 | ||
50 | namespace OpenSim.Region.Framework.Tests | 49 | namespace OpenSim.Region.Framework.Tests |
51 | { | 50 | { |
@@ -95,7 +94,9 @@ namespace OpenSim.Region.Framework.Tests | |||
95 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 94 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
96 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 95 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
97 | 96 | ||
98 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); | 97 | string message; |
98 | |||
99 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message); | ||
99 | 100 | ||
100 | InventoryItemBase retrievedItem1 | 101 | InventoryItemBase retrievedItem1 |
101 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); | 102 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); |
@@ -103,7 +104,7 @@ namespace OpenSim.Region.Framework.Tests | |||
103 | Assert.That(retrievedItem1, Is.Not.Null); | 104 | Assert.That(retrievedItem1, Is.Not.Null); |
104 | 105 | ||
105 | // Try giving back the freshly received item | 106 | // Try giving back the freshly received item |
106 | scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); | 107 | scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID, out message); |
107 | 108 | ||
108 | List<InventoryItemBase> reretrievedItems | 109 | List<InventoryItemBase> reretrievedItems |
109 | = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); | 110 | = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); |
@@ -123,7 +124,7 @@ namespace OpenSim.Region.Framework.Tests | |||
123 | InventoryFolderBase folder1 | 124 | InventoryFolderBase folder1 |
124 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); | 125 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); |
125 | 126 | ||
126 | scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); | 127 | scene.GiveInventoryFolder(null, user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); |
127 | 128 | ||
128 | InventoryFolderBase retrievedFolder1 | 129 | InventoryFolderBase retrievedFolder1 |
129 | = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); | 130 | = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); |
@@ -131,7 +132,7 @@ namespace OpenSim.Region.Framework.Tests | |||
131 | Assert.That(retrievedFolder1, Is.Not.Null); | 132 | Assert.That(retrievedFolder1, Is.Not.Null); |
132 | 133 | ||
133 | // Try giving back the freshly received folder | 134 | // Try giving back the freshly received folder |
134 | scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); | 135 | scene.GiveInventoryFolder(null, user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); |
135 | 136 | ||
136 | List<InventoryFolderBase> reretrievedFolders | 137 | List<InventoryFolderBase> reretrievedFolders |
137 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); | 138 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 1e59e3f..937c414 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -33,7 +33,6 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
36 | using OpenSim.Tests.Common.Mock; | ||
37 | 36 | ||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | 37 | namespace OpenSim.Region.Framework.Scenes.Tests |
39 | { | 38 | { |
@@ -62,11 +61,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
62 | = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); | 61 | = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); |
63 | m_assetService.Store(corruptAsset); | 62 | m_assetService.Store(corruptAsset); |
64 | 63 | ||
65 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | 64 | m_uuidGatherer.AddForInspection(corruptAssetUuid); |
66 | m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, (sbyte)AssetType.Object, foundAssetUuids); | 65 | m_uuidGatherer.GatherAll(); |
67 | 66 | ||
68 | // We count the uuid as gathered even if the asset itself is corrupt. | 67 | // We count the uuid as gathered even if the asset itself is corrupt. |
69 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 68 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1)); |
70 | } | 69 | } |
71 | 70 | ||
72 | /// <summary> | 71 | /// <summary> |
@@ -78,38 +77,82 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
78 | TestHelpers.InMethod(); | 77 | TestHelpers.InMethod(); |
79 | 78 | ||
80 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | 79 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); |
81 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | ||
82 | |||
83 | m_uuidGatherer.GatherAssetUuids(missingAssetUuid, (sbyte)AssetType.Object, foundAssetUuids); | ||
84 | 80 | ||
85 | // We count the uuid as gathered even if the asset itself is missing. | 81 | m_uuidGatherer.AddForInspection(missingAssetUuid); |
86 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 82 | m_uuidGatherer.GatherAll(); |
83 | |||
84 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(0)); | ||
87 | } | 85 | } |
88 | 86 | ||
89 | [Test] | 87 | [Test] |
90 | public void TestNotecardAsset() | 88 | public void TestNotecardAsset() |
91 | { | 89 | { |
92 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
93 | // log4net.Config.XmlConfigurator.Configure(); | 91 | // TestHelpers.EnableLogging(); |
94 | 92 | ||
95 | UUID ownerId = TestHelpers.ParseTail(0x10); | 93 | UUID ownerId = TestHelpers.ParseTail(0x10); |
96 | UUID soAssetId = TestHelpers.ParseTail(0x20); | 94 | UUID embeddedId = TestHelpers.ParseTail(0x20); |
95 | UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); | ||
96 | UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); | ||
97 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | 97 | UUID ncAssetId = TestHelpers.ParseTail(0x30); |
98 | 98 | ||
99 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); | 99 | AssetBase ncAsset |
100 | AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); | 100 | = AssetHelpers.CreateNotecardAsset( |
101 | m_assetService.Store(soAsset); | 101 | ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); |
102 | |||
103 | AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString()); | ||
104 | m_assetService.Store(ncAsset); | 102 | m_assetService.Store(ncAsset); |
105 | 103 | ||
106 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | 104 | AssetBase embeddedAsset |
107 | m_uuidGatherer.GatherAssetUuids(ncAssetId, (sbyte)AssetType.Notecard, foundAssetUuids); | 105 | = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); |
106 | m_assetService.Store(embeddedAsset); | ||
108 | 107 | ||
109 | // We count the uuid as gathered even if the asset itself is corrupt. | 108 | AssetBase secondLevelEmbeddedAsset |
110 | Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); | 109 | = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); |
111 | Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); | 110 | m_assetService.Store(secondLevelEmbeddedAsset); |
112 | Assert.That(foundAssetUuids.ContainsKey(soAssetId)); | 111 | |
112 | m_uuidGatherer.AddForInspection(ncAssetId); | ||
113 | m_uuidGatherer.GatherAll(); | ||
114 | |||
115 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) | ||
116 | // System.Console.WriteLine("key : {0}", key); | ||
117 | |||
118 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); | ||
119 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); | ||
120 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | ||
121 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); | ||
122 | } | ||
123 | |||
124 | [Test] | ||
125 | public void TestTaskItems() | ||
126 | { | ||
127 | TestHelpers.InMethod(); | ||
128 | // TestHelpers.EnableLogging(); | ||
129 | |||
130 | UUID ownerId = TestHelpers.ParseTail(0x10); | ||
131 | |||
132 | SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20); | ||
133 | SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21); | ||
134 | SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22); | ||
135 | |||
136 | TaskInventoryHelpers.AddScript( | ||
137 | m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish"); | ||
138 | |||
139 | TaskInventoryHelpers.AddSceneObject( | ||
140 | m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42)); | ||
141 | TaskInventoryHelpers.AddSceneObject( | ||
142 | m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41)); | ||
143 | |||
144 | m_uuidGatherer.AddForInspection(soL0); | ||
145 | m_uuidGatherer.GatherAll(); | ||
146 | |||
147 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) | ||
148 | // System.Console.WriteLine("key : {0}", key); | ||
149 | |||
150 | // We expect to see the default prim texture and the assets of the contained task items | ||
151 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4)); | ||
152 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture))); | ||
153 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41))); | ||
154 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42))); | ||
155 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43))); | ||
113 | } | 156 | } |
114 | } | 157 | } |
115 | } | 158 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 67655d6..25bbd3a 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -55,37 +55,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
55 | { | 55 | { |
56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 57 | ||
58 | /// <summary> | ||
59 | /// Is gathering complete? | ||
60 | /// </summary> | ||
61 | public bool Complete { get { return m_assetUuidsToInspect.Count <= 0; } } | ||
62 | |||
63 | /// <summary> | ||
64 | /// The dictionary of UUIDs gathered so far. If Complete == true then this is all the reachable UUIDs. | ||
65 | /// </summary> | ||
66 | /// <value>The gathered uuids.</value> | ||
67 | public IDictionary<UUID, sbyte> GatheredUuids { get; private set; } | ||
68 | |||
69 | /// <summary> | ||
70 | /// Gets the next UUID to inspect. | ||
71 | /// </summary> | ||
72 | /// <value>If there is no next UUID then returns null</value> | ||
73 | public UUID? NextUuidToInspect | ||
74 | { | ||
75 | get | ||
76 | { | ||
77 | if (Complete) | ||
78 | return null; | ||
79 | else | ||
80 | return m_assetUuidsToInspect.Peek(); | ||
81 | } | ||
82 | } | ||
83 | |||
58 | protected IAssetService m_assetService; | 84 | protected IAssetService m_assetService; |
59 | 85 | ||
60 | // /// <summary> | 86 | protected Queue<UUID> m_assetUuidsToInspect; |
61 | // /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate | 87 | |
62 | // /// asset was found by the asset service. | 88 | /// <summary> |
63 | // /// </summary> | 89 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. |
64 | // private AssetBase m_requestedObjectAsset; | 90 | /// </summary> |
65 | // | 91 | /// <remarks>In this case the collection of gathered assets will start out blank.</remarks> |
66 | // /// <summary> | 92 | /// <param name="assetService"> |
67 | // /// Signal whether we are currently waiting for the asset service to deliver an asset. | 93 | /// Asset service. |
68 | // /// </summary> | 94 | /// </param> |
69 | // private bool m_waitingForObjectAsset; | 95 | public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>()) {} |
70 | 96 | ||
71 | public UuidGatherer(IAssetService assetService) | 97 | /// <summary> |
98 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. | ||
99 | /// </summary> | ||
100 | /// <param name="assetService"> | ||
101 | /// Asset service. | ||
102 | /// </param> | ||
103 | /// <param name="collector"> | ||
104 | /// Gathered UUIDs will be collected in this dictinaory. | ||
105 | /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. | ||
106 | /// </param> | ||
107 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) | ||
72 | { | 108 | { |
73 | m_assetService = assetService; | 109 | m_assetService = assetService; |
110 | GatheredUuids = collector; | ||
111 | |||
112 | // FIXME: Not efficient for searching, can improve. | ||
113 | m_assetUuidsToInspect = new Queue<UUID>(); | ||
74 | } | 114 | } |
75 | 115 | ||
76 | /// <summary> | 116 | /// <summary> |
77 | /// Gather all the asset uuids associated with the asset referenced by a given uuid | 117 | /// Adds the asset uuid for inspection during the gathering process. |
78 | /// </summary> | 118 | /// </summary> |
79 | /// <remarks> | 119 | /// <returns><c>true</c>, if for inspection was added, <c>false</c> otherwise.</returns> |
80 | /// This includes both those directly associated with | 120 | /// <param name="uuid">UUID.</param> |
81 | /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained | 121 | public bool AddForInspection(UUID uuid) |
82 | /// within this object). | ||
83 | /// </remarks> | ||
84 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> | ||
85 | /// <param name="assetType">The type of the asset for the uuid given</param> | ||
86 | /// <param name="assetUuids">The assets gathered</param> | ||
87 | public void GatherAssetUuids(UUID assetUuid, sbyte assetType, IDictionary<UUID, sbyte> assetUuids) | ||
88 | { | 122 | { |
123 | <<<<<<< HEAD | ||
124 | if (m_assetUuidsToInspect.Contains(uuid)) | ||
125 | return false; | ||
126 | |||
127 | // m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid); | ||
128 | |||
129 | m_assetUuidsToInspect.Enqueue(uuid); | ||
130 | ======= | ||
89 | try | 131 | try |
90 | { | 132 | { |
91 | assetUuids[assetUuid] = assetType; | 133 | assetUuids[assetUuid] = assetType; |
@@ -123,7 +165,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
123 | throw; | 165 | throw; |
124 | } | 166 | } |
125 | } | 167 | } |
168 | >>>>>>> avn/ubitvar | ||
126 | 169 | ||
170 | return true; | ||
171 | } | ||
172 | |||
127 | /// <summary> | 173 | /// <summary> |
128 | /// Gather all the asset uuids associated with a given object. | 174 | /// Gather all the asset uuids associated with a given object. |
129 | /// </summary> | 175 | /// </summary> |
@@ -133,22 +179,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
133 | /// within this object). | 179 | /// within this object). |
134 | /// </remarks> | 180 | /// </remarks> |
135 | /// <param name="sceneObject">The scene object for which to gather assets</param> | 181 | /// <param name="sceneObject">The scene object for which to gather assets</param> |
136 | /// <param name="assetUuids"> | 182 | public void AddForInspection(SceneObjectGroup sceneObject) |
137 | /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset. | ||
138 | /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown. | ||
139 | /// </param> | ||
140 | public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, sbyte> assetUuids) | ||
141 | { | 183 | { |
142 | // m_log.DebugFormat( | 184 | // m_log.DebugFormat( |
143 | // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); | 185 | // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); |
144 | 186 | ||
145 | SceneObjectPart[] parts = sceneObject.Parts; | 187 | SceneObjectPart[] parts = sceneObject.Parts; |
146 | for (int i = 0; i < parts.Length; i++) | 188 | for (int i = 0; i < parts.Length; i++) |
147 | { | 189 | { |
148 | SceneObjectPart part = parts[i]; | 190 | SceneObjectPart part = parts[i]; |
149 | 191 | ||
150 | // m_log.DebugFormat( | 192 | // m_log.DebugFormat( |
151 | // "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID); | 193 | // "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID); |
152 | 194 | ||
153 | try | 195 | try |
154 | { | 196 | { |
@@ -157,7 +199,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
157 | { | 199 | { |
158 | // Get the prim's default texture. This will be used for faces which don't have their own texture | 200 | // Get the prim's default texture. This will be used for faces which don't have their own texture |
159 | if (textureEntry.DefaultTexture != null) | 201 | if (textureEntry.DefaultTexture != null) |
160 | assetUuids[textureEntry.DefaultTexture.TextureID] = (sbyte)AssetType.Texture; | 202 | RecordTextureEntryAssetUuids(textureEntry.DefaultTexture); |
161 | 203 | ||
162 | if (textureEntry.FaceTextures != null) | 204 | if (textureEntry.FaceTextures != null) |
163 | { | 205 | { |
@@ -165,20 +207,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
165 | foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) | 207 | foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) |
166 | { | 208 | { |
167 | if (texture != null) | 209 | if (texture != null) |
168 | assetUuids[texture.TextureID] = (sbyte)AssetType.Texture; | 210 | RecordTextureEntryAssetUuids(texture); |
169 | } | 211 | } |
170 | } | 212 | } |
171 | } | 213 | } |
172 | 214 | ||
173 | // If the prim is a sculpt then preserve this information too | 215 | // If the prim is a sculpt then preserve this information too |
174 | if (part.Shape.SculptTexture != UUID.Zero) | 216 | if (part.Shape.SculptTexture != UUID.Zero) |
175 | assetUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture; | 217 | GatheredUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture; |
176 | 218 | ||
177 | if (part.Shape.ProjectionTextureUUID != UUID.Zero) | 219 | if (part.Shape.ProjectionTextureUUID != UUID.Zero) |
178 | assetUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture; | 220 | GatheredUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture; |
179 | 221 | ||
180 | if (part.CollisionSound != UUID.Zero) | 222 | if (part.CollisionSound != UUID.Zero) |
181 | assetUuids[part.CollisionSound] = (sbyte)AssetType.Sound; | 223 | GatheredUuids[part.CollisionSound] = (sbyte)AssetType.Sound; |
182 | 224 | ||
183 | if (part.ParticleSystem.Length > 0) | 225 | if (part.ParticleSystem.Length > 0) |
184 | { | 226 | { |
@@ -186,9 +228,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
186 | { | 228 | { |
187 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0); | 229 | Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0); |
188 | if (ps.Texture != UUID.Zero) | 230 | if (ps.Texture != UUID.Zero) |
189 | assetUuids[ps.Texture] = (sbyte)AssetType.Texture; | 231 | GatheredUuids[ps.Texture] = (sbyte)AssetType.Texture; |
190 | } | 232 | } |
191 | catch (Exception e) | 233 | catch (Exception) |
192 | { | 234 | { |
193 | m_log.WarnFormat( | 235 | m_log.WarnFormat( |
194 | "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.", | 236 | "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.", |
@@ -197,27 +239,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | } | 239 | } |
198 | 240 | ||
199 | TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); | 241 | TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); |
200 | 242 | ||
201 | // Now analyze this prim's inventory items to preserve all the uuids that they reference | 243 | // Now analyze this prim's inventory items to preserve all the uuids that they reference |
202 | foreach (TaskInventoryItem tii in taskDictionary.Values) | 244 | foreach (TaskInventoryItem tii in taskDictionary.Values) |
203 | { | 245 | { |
204 | // m_log.DebugFormat( | 246 | // m_log.DebugFormat( |
205 | // "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", | 247 | // "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", |
206 | // tii.Name, tii.Type, part.Name, part.UUID); | 248 | // tii.Name, tii.Type, part.Name, part.UUID); |
207 | 249 | ||
208 | if (!assetUuids.ContainsKey(tii.AssetID)) | 250 | if (!GatheredUuids.ContainsKey(tii.AssetID)) |
209 | GatherAssetUuids(tii.AssetID, (sbyte)tii.Type, assetUuids); | 251 | AddForInspection(tii.AssetID, (sbyte)tii.Type); |
210 | } | 252 | } |
211 | 253 | ||
212 | // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed | 254 | // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed |
213 | // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and | 255 | // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and |
214 | // inventory transfer. There needs to be a way for a module to register a method without assuming a | 256 | // inventory transfer. There needs to be a way for a module to register a method without assuming a |
215 | // Scene.EventManager is present. | 257 | // Scene.EventManager is present. |
216 | // part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); | 258 | // part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); |
217 | 259 | ||
218 | 260 | ||
219 | // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs | 261 | // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs |
220 | GatherMaterialsUuids(part, assetUuids); | 262 | RecordMaterialsUuids(part); |
221 | } | 263 | } |
222 | catch (Exception e) | 264 | catch (Exception e) |
223 | { | 265 | { |
@@ -229,27 +271,144 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | } | 271 | } |
230 | } | 272 | } |
231 | 273 | ||
232 | // /// <summary> | 274 | /// <summary> |
233 | // /// The callback made when we request the asset for an object from the asset service. | 275 | /// Gathers the next set of assets returned by the next uuid to get from the asset service. |
234 | // /// </summary> | 276 | /// </summary> |
235 | // private void AssetReceived(string id, Object sender, AssetBase asset) | 277 | /// <returns>false if gathering is already complete, true otherwise</returns> |
236 | // { | 278 | public bool GatherNext() |
237 | // lock (this) | 279 | { |
238 | // { | 280 | if (Complete) |
239 | // m_requestedObjectAsset = asset; | 281 | return false; |
240 | // m_waitingForObjectAsset = false; | 282 | |
241 | // Monitor.Pulse(this); | 283 | UUID nextToInspect = m_assetUuidsToInspect.Dequeue(); |
242 | // } | 284 | |
243 | // } | 285 | // m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect); |
286 | |||
287 | GetAssetUuids(nextToInspect); | ||
288 | |||
289 | return true; | ||
290 | } | ||
291 | |||
292 | /// <summary> | ||
293 | /// Gathers all remaining asset UUIDS no matter how many calls are required to the asset service. | ||
294 | /// </summary> | ||
295 | /// <returns>false if gathering is already complete, true otherwise</returns> | ||
296 | public bool GatherAll() | ||
297 | { | ||
298 | if (Complete) | ||
299 | return false; | ||
300 | |||
301 | while (GatherNext()); | ||
302 | |||
303 | return true; | ||
304 | } | ||
305 | |||
306 | /// <summary> | ||
307 | /// Gather all the asset uuids associated with the asset referenced by a given uuid | ||
308 | /// </summary> | ||
309 | /// <remarks> | ||
310 | /// This includes both those directly associated with | ||
311 | /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained | ||
312 | /// within this object). | ||
313 | /// This method assumes that the asset type associated with this asset in persistent storage is correct (which | ||
314 | /// should always be the case). So with this method we always need to retrieve asset data even if the asset | ||
315 | /// is of a type which is known not to reference any other assets | ||
316 | /// </remarks> | ||
317 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> | ||
318 | private void GetAssetUuids(UUID assetUuid) | ||
319 | { | ||
320 | // avoid infinite loops | ||
321 | if (GatheredUuids.ContainsKey(assetUuid)) | ||
322 | return; | ||
323 | |||
324 | try | ||
325 | { | ||
326 | AssetBase assetBase = GetAsset(assetUuid); | ||
327 | |||
328 | if (null != assetBase) | ||
329 | { | ||
330 | sbyte assetType = assetBase.Type; | ||
331 | GatheredUuids[assetUuid] = assetType; | ||
332 | |||
333 | if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType) | ||
334 | { | ||
335 | RecordWearableAssetUuids(assetBase); | ||
336 | } | ||
337 | else if ((sbyte)AssetType.Gesture == assetType) | ||
338 | { | ||
339 | RecordGestureAssetUuids(assetBase); | ||
340 | } | ||
341 | else if ((sbyte)AssetType.Notecard == assetType) | ||
342 | { | ||
343 | RecordTextEmbeddedAssetUuids(assetBase); | ||
344 | } | ||
345 | else if ((sbyte)AssetType.LSLText == assetType) | ||
346 | { | ||
347 | RecordTextEmbeddedAssetUuids(assetBase); | ||
348 | } | ||
349 | else if ((sbyte)OpenSimAssetType.Material == assetType) | ||
350 | { | ||
351 | RecordMaterialAssetUuids(assetBase); | ||
352 | } | ||
353 | else if ((sbyte)AssetType.Object == assetType) | ||
354 | { | ||
355 | RecordSceneObjectAssetUuids(assetBase); | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | catch (Exception) | ||
360 | { | ||
361 | m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset id {0}", assetUuid); | ||
362 | throw; | ||
363 | } | ||
364 | } | ||
365 | |||
366 | private void AddForInspection(UUID assetUuid, sbyte assetType) | ||
367 | { | ||
368 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered | ||
369 | try | ||
370 | { | ||
371 | if ((sbyte)AssetType.Bodypart == assetType | ||
372 | || (sbyte)AssetType.Clothing == assetType | ||
373 | || (sbyte)AssetType.Gesture == assetType | ||
374 | || (sbyte)AssetType.Notecard == assetType | ||
375 | || (sbyte)AssetType.LSLText == assetType | ||
376 | || (sbyte)OpenSimAssetType.Material == assetType | ||
377 | || (sbyte)AssetType.Object == assetType) | ||
378 | { | ||
379 | AddForInspection(assetUuid); | ||
380 | } | ||
381 | else | ||
382 | { | ||
383 | GatheredUuids[assetUuid] = assetType; | ||
384 | } | ||
385 | } | ||
386 | catch (Exception) | ||
387 | { | ||
388 | m_log.ErrorFormat( | ||
389 | "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", | ||
390 | assetUuid, assetType); | ||
391 | throw; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | /// <summary> | ||
396 | /// Collect all the asset uuids found in one face of a Texture Entry. | ||
397 | /// </summary> | ||
398 | private void RecordTextureEntryAssetUuids(Primitive.TextureEntryFace texture) | ||
399 | { | ||
400 | GatheredUuids[texture.TextureID] = (sbyte)AssetType.Texture; | ||
401 | |||
402 | if (texture.MaterialID != UUID.Zero) | ||
403 | AddForInspection(texture.MaterialID); | ||
404 | } | ||
244 | 405 | ||
245 | /// <summary> | 406 | /// <summary> |
246 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps | 407 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps |
247 | /// stored in legacy format in part.DynAttrs | 408 | /// stored in legacy format in part.DynAttrs |
248 | /// </summary> | 409 | /// </summary> |
249 | /// <param name="part"></param> | 410 | /// <param name="part"></param> |
250 | /// <param name="assetUuids"></param> | 411 | private void RecordMaterialsUuids(SceneObjectPart part) |
251 | //public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) | ||
252 | public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, sbyte> assetUuids) | ||
253 | { | 412 | { |
254 | // scan thru the dynAttrs map of this part for any textures used as materials | 413 | // scan thru the dynAttrs map of this part for any textures used as materials |
255 | OSD osdMaterials = null; | 414 | OSD osdMaterials = null; |
@@ -285,7 +444,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | UUID normalMapId = mat["NormMap"].AsUUID(); | 444 | UUID normalMapId = mat["NormMap"].AsUUID(); |
286 | if (normalMapId != UUID.Zero) | 445 | if (normalMapId != UUID.Zero) |
287 | { | 446 | { |
288 | assetUuids[normalMapId] = (sbyte)AssetType.Texture; | 447 | GatheredUuids[normalMapId] = (sbyte)AssetType.Texture; |
289 | //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); | 448 | //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); |
290 | } | 449 | } |
291 | } | 450 | } |
@@ -294,7 +453,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
294 | UUID specularMapId = mat["SpecMap"].AsUUID(); | 453 | UUID specularMapId = mat["SpecMap"].AsUUID(); |
295 | if (specularMapId != UUID.Zero) | 454 | if (specularMapId != UUID.Zero) |
296 | { | 455 | { |
297 | assetUuids[specularMapId] = (sbyte)AssetType.Texture; | 456 | GatheredUuids[specularMapId] = (sbyte)AssetType.Texture; |
298 | //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); | 457 | //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); |
299 | } | 458 | } |
300 | } | 459 | } |
@@ -310,7 +469,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | } | 469 | } |
311 | } | 470 | } |
312 | } | 471 | } |
313 | 472 | ||
314 | /// <summary> | 473 | /// <summary> |
315 | /// Get an asset synchronously, potentially using an asynchronous callback. If the | 474 | /// Get an asset synchronously, potentially using an asynchronous callback. If the |
316 | /// asynchronous callback is used, we will wait for it to complete. | 475 | /// asynchronous callback is used, we will wait for it to complete. |
@@ -320,83 +479,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
320 | protected virtual AssetBase GetAsset(UUID uuid) | 479 | protected virtual AssetBase GetAsset(UUID uuid) |
321 | { | 480 | { |
322 | return m_assetService.Get(uuid.ToString()); | 481 | return m_assetService.Get(uuid.ToString()); |
323 | |||
324 | // XXX: Switching to do this synchronously where the call was async before but we always waited for it | ||
325 | // to complete anyway! | ||
326 | // m_waitingForObjectAsset = true; | ||
327 | // m_assetCache.Get(uuid.ToString(), this, AssetReceived); | ||
328 | // | ||
329 | // // The asset cache callback can either | ||
330 | // // | ||
331 | // // 1. Complete on the same thread (if the asset is already in the cache) or | ||
332 | // // 2. Come in via a different thread (if we need to go fetch it). | ||
333 | // // | ||
334 | // // The code below handles both these alternatives. | ||
335 | // lock (this) | ||
336 | // { | ||
337 | // if (m_waitingForObjectAsset) | ||
338 | // { | ||
339 | // Monitor.Wait(this); | ||
340 | // m_waitingForObjectAsset = false; | ||
341 | // } | ||
342 | // } | ||
343 | // | ||
344 | // return m_requestedObjectAsset; | ||
345 | } | 482 | } |
346 | 483 | ||
347 | /// <summary> | 484 | /// <summary> |
348 | /// Record the asset uuids embedded within the given script. | 485 | /// Record the asset uuids embedded within the given text (e.g. a script). |
349 | /// </summary> | 486 | /// </summary> |
350 | /// <param name="scriptUuid"></param> | 487 | /// <param name="textAsset"></param> |
351 | /// <param name="assetUuids">Dictionary in which to record the references</param> | 488 | private void RecordTextEmbeddedAssetUuids(AssetBase textAsset) |
352 | private void GetTextEmbeddedAssetUuids(UUID embeddingAssetId, IDictionary<UUID, sbyte> assetUuids) | ||
353 | { | 489 | { |
354 | // m_log.DebugFormat("[ASSET GATHERER]: Getting assets for uuid references in asset {0}", embeddingAssetId); | 490 | // m_log.DebugFormat("[ASSET GATHERER]: Getting assets for uuid references in asset {0}", embeddingAssetId); |
355 | 491 | ||
356 | AssetBase embeddingAsset = GetAsset(embeddingAssetId); | 492 | string text = Utils.BytesToString(textAsset.Data); |
493 | // m_log.DebugFormat("[UUID GATHERER]: Text {0}", text); | ||
494 | MatchCollection uuidMatches = Util.PermissiveUUIDPattern.Matches(text); | ||
495 | // m_log.DebugFormat("[UUID GATHERER]: Found {0} matches in text", uuidMatches.Count); | ||
357 | 496 | ||
358 | if (null != embeddingAsset) | 497 | foreach (Match uuidMatch in uuidMatches) |
359 | { | 498 | { |
360 | string script = Utils.BytesToString(embeddingAsset.Data); | 499 | UUID uuid = new UUID(uuidMatch.Value); |
361 | // m_log.DebugFormat("[ARCHIVER]: Script {0}", script); | 500 | // m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid); |
362 | MatchCollection uuidMatches = Util.PermissiveUUIDPattern.Matches(script); | ||
363 | // m_log.DebugFormat("[ARCHIVER]: Found {0} matches in text", uuidMatches.Count); | ||
364 | 501 | ||
365 | foreach (Match uuidMatch in uuidMatches) | 502 | AddForInspection(uuid); |
366 | { | ||
367 | UUID uuid = new UUID(uuidMatch.Value); | ||
368 | // m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); | ||
369 | |||
370 | // Embedded asset references (if not false positives) could be for many types of asset, so we will | ||
371 | // label these as unknown. | ||
372 | assetUuids[uuid] = (sbyte)AssetType.Unknown; | ||
373 | } | ||
374 | } | 503 | } |
375 | } | 504 | } |
376 | 505 | ||
377 | /// <summary> | 506 | /// <summary> |
378 | /// Record the uuids referenced by the given wearable asset | 507 | /// Record the uuids referenced by the given wearable asset |
379 | /// </summary> | 508 | /// </summary> |
380 | /// <param name="wearableAssetUuid"></param> | 509 | /// <param name="assetBase"></param> |
381 | /// <param name="assetUuids">Dictionary in which to record the references</param> | 510 | private void RecordWearableAssetUuids(AssetBase assetBase) |
382 | private void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, sbyte> assetUuids) | ||
383 | { | 511 | { |
384 | AssetBase assetBase = GetAsset(wearableAssetUuid); | 512 | //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); |
513 | AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data); | ||
514 | wearableAsset.Decode(); | ||
385 | 515 | ||
386 | if (null != assetBase) | 516 | //m_log.DebugFormat( |
387 | { | 517 | // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); |
388 | //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); | 518 | |
389 | AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); | 519 | foreach (UUID uuid in wearableAsset.Textures.Values) |
390 | wearableAsset.Decode(); | 520 | GatheredUuids[uuid] = (sbyte)AssetType.Texture; |
391 | |||
392 | //m_log.DebugFormat( | ||
393 | // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); | ||
394 | |||
395 | foreach (UUID uuid in wearableAsset.Textures.Values) | ||
396 | { | ||
397 | assetUuids[uuid] = (sbyte)AssetType.Texture; | ||
398 | } | ||
399 | } | ||
400 | } | 521 | } |
401 | 522 | ||
402 | /// <summary> | 523 | /// <summary> |
@@ -404,93 +525,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
404 | /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained | 525 | /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained |
405 | /// within this object). | 526 | /// within this object). |
406 | /// </summary> | 527 | /// </summary> |
407 | /// <param name="sceneObject"></param> | 528 | /// <param name="sceneObjectAsset"></param> |
408 | /// <param name="assetUuids"></param> | 529 | private void RecordSceneObjectAssetUuids(AssetBase sceneObjectAsset) |
409 | private void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, sbyte> assetUuids) | ||
410 | { | 530 | { |
411 | AssetBase objectAsset = GetAsset(sceneObjectUuid); | 531 | string xml = Utils.BytesToString(sceneObjectAsset.Data); |
412 | 532 | ||
413 | if (null != objectAsset) | 533 | CoalescedSceneObjects coa; |
534 | if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa)) | ||
414 | { | 535 | { |
415 | string xml = Utils.BytesToString(objectAsset.Data); | 536 | foreach (SceneObjectGroup sog in coa.Objects) |
416 | 537 | AddForInspection(sog); | |
417 | CoalescedSceneObjects coa; | 538 | } |
418 | if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa)) | 539 | else |
419 | { | 540 | { |
420 | foreach (SceneObjectGroup sog in coa.Objects) | 541 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); |
421 | GatherAssetUuids(sog, assetUuids); | 542 | |
422 | } | 543 | if (null != sog) |
423 | else | 544 | AddForInspection(sog); |
424 | { | ||
425 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); | ||
426 | |||
427 | if (null != sog) | ||
428 | GatherAssetUuids(sog, assetUuids); | ||
429 | } | ||
430 | } | 545 | } |
431 | } | 546 | } |
432 | 547 | ||
433 | /// <summary> | 548 | /// <summary> |
434 | /// Get the asset uuid associated with a gesture | 549 | /// Get the asset uuid associated with a gesture |
435 | /// </summary> | 550 | /// </summary> |
436 | /// <param name="gestureUuid"></param> | 551 | /// <param name="gestureAsset"></param> |
437 | /// <param name="assetUuids"></param> | 552 | private void RecordGestureAssetUuids(AssetBase gestureAsset) |
438 | private void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, sbyte> assetUuids) | 553 | { |
439 | { | 554 | using (MemoryStream ms = new MemoryStream(gestureAsset.Data)) |
440 | AssetBase assetBase = GetAsset(gestureUuid); | 555 | using (StreamReader sr = new StreamReader(ms)) |
441 | if (null == assetBase) | ||
442 | return; | ||
443 | |||
444 | MemoryStream ms = new MemoryStream(assetBase.Data); | ||
445 | StreamReader sr = new StreamReader(ms); | ||
446 | |||
447 | sr.ReadLine(); // Unknown (Version?) | ||
448 | sr.ReadLine(); // Unknown | ||
449 | sr.ReadLine(); // Unknown | ||
450 | sr.ReadLine(); // Name | ||
451 | sr.ReadLine(); // Comment ? | ||
452 | int count = Convert.ToInt32(sr.ReadLine()); // Item count | ||
453 | |||
454 | for (int i = 0 ; i < count ; i++) | ||
455 | { | 556 | { |
456 | string type = sr.ReadLine(); | 557 | sr.ReadLine(); // Unknown (Version?) |
457 | if (type == null) | 558 | sr.ReadLine(); // Unknown |
458 | break; | 559 | sr.ReadLine(); // Unknown |
459 | string name = sr.ReadLine(); | 560 | sr.ReadLine(); // Name |
460 | if (name == null) | 561 | sr.ReadLine(); // Comment ? |
461 | break; | 562 | int count = Convert.ToInt32(sr.ReadLine()); // Item count |
462 | string id = sr.ReadLine(); | 563 | |
463 | if (id == null) | 564 | for (int i = 0 ; i < count ; i++) |
464 | break; | 565 | { |
465 | string unknown = sr.ReadLine(); | 566 | string type = sr.ReadLine(); |
466 | if (unknown == null) | 567 | if (type == null) |
467 | break; | 568 | break; |
468 | 569 | string name = sr.ReadLine(); | |
469 | // If it can be parsed as a UUID, it is an asset ID | 570 | if (name == null) |
470 | UUID uuid; | 571 | break; |
471 | if (UUID.TryParse(id, out uuid)) | 572 | string id = sr.ReadLine(); |
472 | assetUuids[uuid] = (sbyte)AssetType.Animation; | 573 | if (id == null) |
574 | break; | ||
575 | string unknown = sr.ReadLine(); | ||
576 | if (unknown == null) | ||
577 | break; | ||
578 | |||
579 | // If it can be parsed as a UUID, it is an asset ID | ||
580 | UUID uuid; | ||
581 | if (UUID.TryParse(id, out uuid)) | ||
582 | GatheredUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important | ||
583 | } | ||
473 | } | 584 | } |
474 | } | 585 | } |
475 | 586 | ||
476 | /// <summary> | 587 | /// <summary> |
477 | /// Get the asset uuid's referenced in a material. | 588 | /// Get the asset uuid's referenced in a material. |
478 | /// </summary> | 589 | /// </summary> |
479 | private void GetMaterialAssetUuids(UUID materialUuid, IDictionary<UUID, sbyte> assetUuids) | 590 | private void RecordMaterialAssetUuids(AssetBase materialAsset) |
480 | { | 591 | { |
481 | AssetBase assetBase = GetAsset(materialUuid); | 592 | OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data); |
482 | if (null == assetBase) | ||
483 | return; | ||
484 | |||
485 | OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(assetBase.Data); | ||
486 | 593 | ||
487 | UUID normMap = mat["NormMap"].AsUUID(); | 594 | UUID normMap = mat["NormMap"].AsUUID(); |
488 | if (normMap != UUID.Zero) | 595 | if (normMap != UUID.Zero) |
489 | assetUuids[normMap] = (sbyte)AssetType.Texture; | 596 | GatheredUuids[normMap] = (sbyte)AssetType.Texture; |
490 | 597 | ||
491 | UUID specMap = mat["SpecMap"].AsUUID(); | 598 | UUID specMap = mat["SpecMap"].AsUUID(); |
492 | if (specMap != UUID.Zero) | 599 | if (specMap != UUID.Zero) |
493 | assetUuids[specMap] = (sbyte)AssetType.Texture; | 600 | GatheredUuids[specMap] = (sbyte)AssetType.Texture; |
494 | } | 601 | } |
495 | } | 602 | } |
496 | 603 | ||
@@ -501,7 +608,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
501 | protected string m_assetServerURL; | 608 | protected string m_assetServerURL; |
502 | 609 | ||
503 | public HGUuidGatherer(IAssetService assetService, string assetServerURL) | 610 | public HGUuidGatherer(IAssetService assetService, string assetServerURL) |
504 | : base(assetService) | 611 | : this(assetService, assetServerURL, new Dictionary<UUID, sbyte>()) {} |
612 | |||
613 | public HGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary<UUID, sbyte> collector) | ||
614 | : base(assetService, collector) | ||
505 | { | 615 | { |
506 | m_assetServerURL = assetServerURL; | 616 | m_assetServerURL = assetServerURL; |
507 | if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) | 617 | if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) |
@@ -518,7 +628,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
518 | 628 | ||
519 | public AssetBase FetchAsset(UUID assetID) | 629 | public AssetBase FetchAsset(UUID assetID) |
520 | { | 630 | { |
521 | |||
522 | // Test if it's already here | 631 | // Test if it's already here |
523 | AssetBase asset = m_assetService.Get(assetID.ToString()); | 632 | AssetBase asset = m_assetService.Get(assetID.ToString()); |
524 | if (asset == null) | 633 | if (asset == null) |