diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
16 files changed, 553 insertions, 1486 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 65ae445..ad421ee 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
41 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | private OpenSim.Framework.Animation m_implicitDefaultAnimation = new OpenSim.Framework.Animation(); | ||
45 | private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); | 44 | private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); |
46 | private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); | 45 | private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); |
47 | 46 | ||
@@ -50,11 +49,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
50 | get { return m_defaultAnimation; } | 49 | get { return m_defaultAnimation; } |
51 | } | 50 | } |
52 | 51 | ||
53 | public OpenSim.Framework.Animation ImplicitDefaultAnimation | ||
54 | { | ||
55 | get { return m_implicitDefaultAnimation; } | ||
56 | } | ||
57 | |||
58 | public AnimationSet() | 52 | public AnimationSet() |
59 | { | 53 | { |
60 | ResetDefaultAnimation(); | 54 | ResetDefaultAnimation(); |
@@ -125,18 +119,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
125 | if (m_defaultAnimation.AnimID != animID) | 119 | if (m_defaultAnimation.AnimID != animID) |
126 | { | 120 | { |
127 | m_defaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); | 121 | m_defaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); |
128 | m_implicitDefaultAnimation = m_defaultAnimation; | ||
129 | return true; | 122 | return true; |
130 | } | 123 | } |
131 | return false; | 124 | return false; |
132 | } | 125 | } |
133 | 126 | ||
134 | // Called from serialization only | ||
135 | public void SetImplicitDefaultAnimation(UUID animID, int sequenceNum, UUID objectID) | ||
136 | { | ||
137 | m_implicitDefaultAnimation = new OpenSim.Framework.Animation(animID, sequenceNum, objectID); | ||
138 | } | ||
139 | |||
140 | protected bool ResetDefaultAnimation() | 127 | protected bool ResetDefaultAnimation() |
141 | { | 128 | { |
142 | return TrySetDefaultAnimation("STAND", 1, UUID.Zero); | 129 | return TrySetDefaultAnimation("STAND", 1, UUID.Zero); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 5b1c9f4..4a19c3b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -47,75 +47,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | 47 | ||
48 | public delegate void OnFrameDelegate(); | 48 | public delegate void OnFrameDelegate(); |
49 | 49 | ||
50 | /// <summary> | ||
51 | /// Triggered on each sim frame. | ||
52 | /// </summary> | ||
53 | /// <remarks> | ||
54 | /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Update"/> | ||
55 | /// Core uses it for things like Sun, Wind & Clouds | ||
56 | /// The MRM module also uses it. | ||
57 | /// </remarks> | ||
58 | public event OnFrameDelegate OnFrame; | 50 | public event OnFrameDelegate OnFrame; |
59 | 51 | ||
60 | public delegate void ClientMovement(ScenePresence client); | 52 | public delegate void ClientMovement(ScenePresence client); |
61 | 53 | ||
62 | /// <summary> | ||
63 | /// Trigerred when an agent moves. | ||
64 | /// </summary> | ||
65 | /// <remarks> | ||
66 | /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.HandleAgentUpdate"/> | ||
67 | /// prior to <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.TriggerScenePresenceUpdated"/> | ||
68 | /// </remarks> | ||
69 | public event ClientMovement OnClientMovement; | 54 | public event ClientMovement OnClientMovement; |
70 | 55 | ||
71 | public delegate void OnTerrainTaintedDelegate(); | 56 | public delegate void OnTerrainTaintedDelegate(); |
72 | 57 | ||
73 | /// <summary> | ||
74 | /// Triggered if the terrain has been edited | ||
75 | /// </summary> | ||
76 | /// <remarks> | ||
77 | /// This gets triggered in <see cref="OpenSim.Region.CoreModules.World.Terrain.CheckForTerrainUpdates"/> | ||
78 | /// after it determines that an update has been made. | ||
79 | /// </remarks> | ||
80 | public event OnTerrainTaintedDelegate OnTerrainTainted; | 58 | public event OnTerrainTaintedDelegate OnTerrainTainted; |
81 | 59 | ||
82 | public delegate void OnTerrainTickDelegate(); | 60 | public delegate void OnTerrainTickDelegate(); |
83 | 61 | ||
84 | /// <summary> | ||
85 | /// Triggered if the terrain has been edited | ||
86 | /// </summary> | ||
87 | /// <remarks> | ||
88 | /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.UpdateTerrain"/> | ||
89 | /// but is used by core solely to update the physics engine. | ||
90 | /// </remarks> | ||
91 | public event OnTerrainTickDelegate OnTerrainTick; | ||
92 | |||
93 | public delegate void OnTerrainUpdateDelegate(); | 62 | public delegate void OnTerrainUpdateDelegate(); |
94 | 63 | ||
64 | public event OnTerrainTickDelegate OnTerrainTick; | ||
65 | |||
95 | public event OnTerrainUpdateDelegate OnTerrainUpdate; | 66 | public event OnTerrainUpdateDelegate OnTerrainUpdate; |
96 | 67 | ||
97 | public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); | 68 | public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); |
98 | 69 | ||
99 | /// <summary> | ||
100 | /// Triggered when a region is backed up/persisted to storage | ||
101 | /// </summary> | ||
102 | /// <remarks> | ||
103 | /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Backup"/> | ||
104 | /// and is fired before the persistence occurs. | ||
105 | /// </remarks> | ||
106 | public event OnBackupDelegate OnBackup; | 70 | public event OnBackupDelegate OnBackup; |
107 | 71 | ||
108 | public delegate void OnClientConnectCoreDelegate(IClientCore client); | 72 | public delegate void OnClientConnectCoreDelegate(IClientCore client); |
109 | 73 | ||
110 | /// <summary> | ||
111 | /// Triggered when a new client connects to the scene. | ||
112 | /// </summary> | ||
113 | /// <remarks> | ||
114 | /// This gets triggered in <see cref="TriggerOnNewClient"/>, | ||
115 | /// which checks if an instance of <see cref="OpenSim.Framework.IClientAPI"/> | ||
116 | /// also implements <see cref="OpenSim.Framework.Client.IClientCore"/> and as such, | ||
117 | /// is not triggered by <see cref="OpenSim.Region.OptionalModules.World.NPC">NPCs</see>. | ||
118 | /// </remarks> | ||
119 | public event OnClientConnectCoreDelegate OnClientConnect; | 74 | public event OnClientConnectCoreDelegate OnClientConnect; |
120 | 75 | ||
121 | public delegate void OnNewClientDelegate(IClientAPI client); | 76 | public delegate void OnNewClientDelegate(IClientAPI client); |
@@ -125,96 +80,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
125 | /// </summary> | 80 | /// </summary> |
126 | /// <remarks> | 81 | /// <remarks> |
127 | /// This is triggered for both child and root agent client connections. | 82 | /// This is triggered for both child and root agent client connections. |
128 | /// | ||
129 | /// Triggered before OnClientLogin. | 83 | /// Triggered before OnClientLogin. |
130 | /// | ||
131 | /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please | ||
132 | /// do this on a separate thread. | ||
133 | /// </remarks> | 84 | /// </remarks> |
134 | public event OnNewClientDelegate OnNewClient; | 85 | public event OnNewClientDelegate OnNewClient; |
135 | 86 | ||
136 | /// <summary> | 87 | /// <summary> |
137 | /// Fired if the client entering this sim is doing so as a new login | 88 | /// Fired if the client entering this sim is doing so as a new login |
138 | /// </summary> | 89 | /// </summary> |
139 | /// <remarks> | ||
140 | /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please | ||
141 | /// do this on a separate thread. | ||
142 | /// </remarks> | ||
143 | public event Action<IClientAPI> OnClientLogin; | 90 | public event Action<IClientAPI> OnClientLogin; |
144 | 91 | ||
145 | public delegate void OnNewPresenceDelegate(ScenePresence presence); | 92 | public delegate void OnNewPresenceDelegate(ScenePresence presence); |
146 | 93 | ||
147 | /// <summary> | ||
148 | /// Triggered when a new presence is added to the scene | ||
149 | /// </summary> | ||
150 | /// <remarks> | ||
151 | /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both | ||
152 | /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> | ||
153 | /// </remarks> | ||
154 | public event OnNewPresenceDelegate OnNewPresence; | 94 | public event OnNewPresenceDelegate OnNewPresence; |
155 | 95 | ||
156 | public delegate void OnRemovePresenceDelegate(UUID agentId); | 96 | public delegate void OnRemovePresenceDelegate(UUID agentId); |
157 | 97 | ||
158 | /// <summary> | ||
159 | /// Triggered when a presence is removed from the scene | ||
160 | /// </summary> | ||
161 | /// <remarks> | ||
162 | /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both | ||
163 | /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> | ||
164 | /// | ||
165 | /// Triggered under per-agent lock. So if you want to perform any long-running operations, please | ||
166 | /// do this on a separate thread. | ||
167 | /// </remarks> | ||
168 | public event OnRemovePresenceDelegate OnRemovePresence; | 98 | public event OnRemovePresenceDelegate OnRemovePresence; |
169 | 99 | ||
170 | public delegate void OnParcelPrimCountUpdateDelegate(); | 100 | public delegate void OnParcelPrimCountUpdateDelegate(); |
171 | 101 | ||
172 | /// <summary> | ||
173 | /// Triggered whenever the prim count may have been altered, or prior | ||
174 | /// to an action that requires the current prim count to be accurate. | ||
175 | /// </summary> | ||
176 | /// <remarks> | ||
177 | /// Triggered by <see cref="TriggerParcelPrimCountUpdate"/> in | ||
178 | /// <see cref="OpenSim.OpenSimBase.CreateRegion"/>, | ||
179 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnRequestParcelPrimCountUpdate"/>, | ||
180 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelObjectOwnerRequest"/>, | ||
181 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.GetPrimsFree"/>, | ||
182 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.UpdateLandSold"/>, | ||
183 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.DeedToGroup"/>, | ||
184 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.SendLandUpdateToClient"/> | ||
185 | /// </remarks> | ||
186 | public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; | 102 | public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; |
187 | 103 | ||
188 | public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); | 104 | public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); |
189 | 105 | ||
190 | /// <summary> | ||
191 | /// Triggered in response to <see cref="OnParcelPrimCountUpdate"/> for | ||
192 | /// objects that actually contribute to parcel prim count. | ||
193 | /// </summary> | ||
194 | /// <remarks> | ||
195 | /// Triggered by <see cref="TriggerParcelPrimCountAdd"/> in | ||
196 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnParcelPrimCountUpdate"/> | ||
197 | /// </remarks> | ||
198 | public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; | 106 | public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; |
199 | 107 | ||
200 | public delegate void OnPluginConsoleDelegate(string[] args); | 108 | public delegate void OnPluginConsoleDelegate(string[] args); |
201 | 109 | ||
202 | /// <summary> | ||
203 | /// Triggered after <see cref="OpenSim.IApplicationPlugin.PostInitialise"/> | ||
204 | /// has been called for all <see cref="OpenSim.IApplicationPlugin"/> | ||
205 | /// loaded via <see cref="OpenSim.OpenSimBase.LoadPlugins"/>. | ||
206 | /// Handlers for this event are typically used to parse the arguments | ||
207 | /// from <see cref="OnPluginConsoleDelegate"/> in order to process or | ||
208 | /// filter the arguments and pass them onto <see cref="OpenSim.Region.CoreModules.Framework.InterfaceCommander.Commander.ProcessConsoleCommand"/> | ||
209 | /// </summary> | ||
210 | /// <remarks> | ||
211 | /// Triggered by <see cref="TriggerOnPluginConsole"/> in | ||
212 | /// <see cref="Scene.SendCommandToPlugins"/> via | ||
213 | /// <see cref="SceneManager.SendCommandToPluginModules"/> via | ||
214 | /// <see cref="OpenSim.OpenSimBase.HandleCommanderCommand"/> via | ||
215 | /// <see cref="OpenSim.OpenSimBase.AddPluginCommands"/> via | ||
216 | /// <see cref="OpenSim.OpenSimBase.StartupSpecific"/> | ||
217 | /// </remarks> | ||
218 | public event OnPluginConsoleDelegate OnPluginConsole; | 110 | public event OnPluginConsoleDelegate OnPluginConsole; |
219 | 111 | ||
220 | /// <summary> | 112 | /// <summary> |
@@ -229,28 +121,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | 121 | ||
230 | public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene); | 122 | public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene); |
231 | 123 | ||
232 | /// <summary> | ||
233 | /// Triggered before the grunt work for adding a root agent to a | ||
234 | /// scene has been performed (resuming attachment scripts, physics, | ||
235 | /// animations etc.) | ||
236 | /// </summary> | ||
237 | /// <remarks> | ||
238 | /// Triggered before <see cref="OnMakeRootAgent"/> | ||
239 | /// by <see cref="TriggerSetRootAgentScene"/> | ||
240 | /// in <see cref="ScenePresence.MakeRootAgent"/> | ||
241 | /// via <see cref="Scene.AgentCrossing"/> | ||
242 | /// and <see cref="ScenePresence.CompleteMovement"/> | ||
243 | /// </remarks> | ||
244 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; | 124 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; |
245 | 125 | ||
246 | /// <summary> | ||
247 | /// Triggered after parcel properties have been updated. | ||
248 | /// </summary> | ||
249 | /// <remarks> | ||
250 | /// Triggered by <see cref="TriggerOnParcelPropertiesUpdateRequest"/> in | ||
251 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelPropertiesUpdateRequest"/>, | ||
252 | /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ProcessPropertiesUpdate"/> | ||
253 | /// </remarks> | ||
254 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 126 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
255 | 127 | ||
256 | /// <summary> | 128 | /// <summary> |
@@ -265,45 +137,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
265 | /// <summary> | 137 | /// <summary> |
266 | /// Fired when an object is touched/grabbed. | 138 | /// Fired when an object is touched/grabbed. |
267 | /// </summary> | 139 | /// </summary> |
268 | /// <remarks> | ||
269 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of | 140 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of |
270 | /// the root part. | 141 | /// the root part. |
271 | /// Triggerd in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/> | ||
272 | /// via <see cref="TriggerObjectGrab"/> | ||
273 | /// in <see cref="Scene.ProcessObjectGrab"/> | ||
274 | /// </remarks> | ||
275 | public event ObjectGrabDelegate OnObjectGrab; | 142 | public event ObjectGrabDelegate OnObjectGrab; |
276 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | 143 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); |
277 | 144 | ||
278 | /// <summary> | ||
279 | /// Triggered when an object is being touched/grabbed continuously. | ||
280 | /// </summary> | ||
281 | /// <remarks> | ||
282 | /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabUpdate"/> | ||
283 | /// via <see cref="TriggerObjectGrabbing"/> | ||
284 | /// in <see cref="Scene.ProcessObjectGrabUpdate"/> | ||
285 | /// </remarks> | ||
286 | public event ObjectGrabDelegate OnObjectGrabbing; | 145 | public event ObjectGrabDelegate OnObjectGrabbing; |
287 | |||
288 | /// <summary> | ||
289 | /// Triggered when an object stops being touched/grabbed. | ||
290 | /// </summary> | ||
291 | /// <remarks> | ||
292 | /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnDeGrabObject"/> | ||
293 | /// via <see cref="TriggerObjectDeGrab"/> | ||
294 | /// in <see cref="Scene.ProcessObjectDeGrab"/> | ||
295 | /// </remarks> | ||
296 | public event ObjectDeGrabDelegate OnObjectDeGrab; | 146 | public event ObjectDeGrabDelegate OnObjectDeGrab; |
297 | |||
298 | /// <summary> | ||
299 | /// Triggered when a script resets. | ||
300 | /// </summary> | ||
301 | /// <remarks> | ||
302 | /// Triggered by <see cref="TriggerScriptReset"/> | ||
303 | /// in <see cref="Scene.ProcessScriptReset"/> | ||
304 | /// via <see cref="OpenSim.Framework.IClientAPI.OnScriptReset"/> | ||
305 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleScriptReset"/> | ||
306 | /// </remarks> | ||
307 | public event ScriptResetDelegate OnScriptReset; | 147 | public event ScriptResetDelegate OnScriptReset; |
308 | 148 | ||
309 | public event OnPermissionErrorDelegate OnPermissionError; | 149 | public event OnPermissionErrorDelegate OnPermissionError; |
@@ -313,105 +153,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | /// </summary> | 153 | /// </summary> |
314 | /// <remarks> | 154 | /// <remarks> |
315 | /// Occurs after OnNewScript. | 155 | /// Occurs after OnNewScript. |
316 | /// Triggered by <see cref="TriggerRezScript"/> | ||
317 | /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/> | ||
318 | /// </remarks> | 156 | /// </remarks> |
319 | public event NewRezScript OnRezScript; | 157 | public event NewRezScript OnRezScript; |
320 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); | 158 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); |
321 | 159 | ||
322 | public delegate void RemoveScript(uint localID, UUID itemID); | 160 | public delegate void RemoveScript(uint localID, UUID itemID); |
323 | |||
324 | /// <summary> | ||
325 | /// Triggered when a script is removed from an object. | ||
326 | /// </summary> | ||
327 | /// <remarks> | ||
328 | /// Triggered by <see cref="TriggerRemoveScript"/> | ||
329 | /// in <see cref="Scene.RemoveTaskInventory"/>, | ||
330 | /// <see cref="Scene.CreateAgentInventoryItemFromTask"/>, | ||
331 | /// <see cref="SceneObjectPartInventory.RemoveScriptInstance"/>, | ||
332 | /// <see cref="SceneObjectPartInventory.RemoveInventoryItem"/> | ||
333 | /// </remarks> | ||
334 | public event RemoveScript OnRemoveScript; | 161 | public event RemoveScript OnRemoveScript; |
335 | 162 | ||
336 | public delegate void StartScript(uint localID, UUID itemID); | 163 | public delegate void StartScript(uint localID, UUID itemID); |
337 | |||
338 | /// <summary> | ||
339 | /// Triggered when a script starts. | ||
340 | /// </summary> | ||
341 | /// <remarks> | ||
342 | /// Triggered by <see cref="TriggerStartScript"/> | ||
343 | /// in <see cref="Scene.SetScriptRunning"/> | ||
344 | /// via <see cref="OpenSim.Framework.IClientAPI.OnSetScriptRunning"/>, | ||
345 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.HandleSetScriptRunning"/> | ||
346 | /// </remarks> | ||
347 | public event StartScript OnStartScript; | 164 | public event StartScript OnStartScript; |
348 | 165 | ||
349 | public delegate void StopScript(uint localID, UUID itemID); | 166 | public delegate void StopScript(uint localID, UUID itemID); |
350 | |||
351 | /// <summary> | ||
352 | /// Triggered when a script stops. | ||
353 | /// </summary> | ||
354 | /// <remarks> | ||
355 | /// Triggered by <see cref="TriggerStopScript"/>, | ||
356 | /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>, | ||
357 | /// <see cref="SceneObjectPartInventory.StopScriptInstance"/>, | ||
358 | /// <see cref="Scene.SetScriptRunning"/> | ||
359 | /// </remarks> | ||
360 | public event StopScript OnStopScript; | 167 | public event StopScript OnStopScript; |
361 | 168 | ||
362 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); | 169 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); |
363 | |||
364 | /// <summary> | ||
365 | /// Triggered when an object is moved. | ||
366 | /// </summary> | ||
367 | /// <remarks> | ||
368 | /// Triggered by <see cref="TriggerGroupMove"/> | ||
369 | /// in <see cref="SceneObjectGroup.UpdateGroupPosition"/>, | ||
370 | /// <see cref="SceneObjectGroup.GrabMovement"/> | ||
371 | /// </remarks> | ||
372 | public event SceneGroupMoved OnSceneGroupMove; | 170 | public event SceneGroupMoved OnSceneGroupMove; |
373 | 171 | ||
374 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); | 172 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); |
375 | |||
376 | /// <summary> | ||
377 | /// Triggered when an object is grabbed. | ||
378 | /// </summary> | ||
379 | /// <remarks> | ||
380 | /// Triggered by <see cref="TriggerGroupGrab"/> | ||
381 | /// in <see cref="SceneObjectGroup.OnGrabGroup"/> | ||
382 | /// via <see cref="SceneObjectGroup.ObjectGrabHandler"/> | ||
383 | /// via <see cref="Scene.ProcessObjectGrab"/> | ||
384 | /// via <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/> | ||
385 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectGrab"/> | ||
386 | /// </remarks> | ||
387 | public event SceneGroupGrabed OnSceneGroupGrab; | 173 | public event SceneGroupGrabed OnSceneGroupGrab; |
388 | 174 | ||
389 | public delegate bool SceneGroupSpinStarted(UUID groupID); | 175 | public delegate bool SceneGroupSpinStarted(UUID groupID); |
390 | |||
391 | /// <summary> | ||
392 | /// Triggered when an object starts to spin. | ||
393 | /// </summary> | ||
394 | /// <remarks> | ||
395 | /// Triggered by <see cref="TriggerGroupSpinStart"/> | ||
396 | /// in <see cref="SceneObjectGroup.SpinStart"/> | ||
397 | /// via <see cref="SceneGraph.SpinStart"/> | ||
398 | /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinStart"/> | ||
399 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinStart"/> | ||
400 | /// </remarks> | ||
401 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; | 176 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; |
402 | 177 | ||
403 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); | 178 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); |
404 | |||
405 | /// <summary> | ||
406 | /// Triggered when an object is being spun. | ||
407 | /// </summary> | ||
408 | /// <remarks> | ||
409 | /// Triggered by <see cref="TriggerGroupSpin"/> | ||
410 | /// in <see cref="SceneObjectGroup.SpinMovement"/> | ||
411 | /// via <see cref="SceneGraph.SpinObject"/> | ||
412 | /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinUpdate"/> | ||
413 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinUpdate"/> | ||
414 | /// </remarks> | ||
415 | public event SceneGroupSpun OnSceneGroupSpin; | 179 | public event SceneGroupSpun OnSceneGroupSpin; |
416 | 180 | ||
417 | public delegate void LandObjectAdded(ILandObject newParcel); | 181 | public delegate void LandObjectAdded(ILandObject newParcel); |
@@ -440,9 +204,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
440 | /// </summary> | 204 | /// </summary> |
441 | /// <remarks> | 205 | /// <remarks> |
442 | /// At the point of firing, the scene still contains the client's scene presence. | 206 | /// At the point of firing, the scene still contains the client's scene presence. |
443 | /// | ||
444 | /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please | ||
445 | /// do this on a separate thread. | ||
446 | /// </remarks> | 207 | /// </remarks> |
447 | public event ClientClosed OnClientClosed; | 208 | public event ClientClosed OnClientClosed; |
448 | 209 | ||
@@ -453,9 +214,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
453 | /// </summary> | 214 | /// </summary> |
454 | /// <remarks> | 215 | /// <remarks> |
455 | /// Occurs before OnRezScript | 216 | /// Occurs before OnRezScript |
456 | /// Triggered by <see cref="TriggerNewScript"/> | ||
457 | /// in <see cref="Scene.RezScriptFromAgentInventory"/>, | ||
458 | /// <see cref="Scene.RezNewScript"/> | ||
459 | /// </remarks> | 217 | /// </remarks> |
460 | public event NewScript OnNewScript; | 218 | public event NewScript OnNewScript; |
461 | 219 | ||
@@ -490,12 +248,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
490 | /// </summary> | 248 | /// </summary> |
491 | /// <remarks> | 249 | /// <remarks> |
492 | /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. | 250 | /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. |
493 | /// Triggered by <see cref="TriggerUpdateScript"/> | ||
494 | /// in <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/> | ||
495 | /// via <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/> | ||
496 | /// via <see cref="OpenSim.Region.ClientStack.Linden.BunchOfCaps.TaskScriptUpdated"/> | ||
497 | /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.OnUpLoad"/> | ||
498 | /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.uploaderCaps"/> | ||
499 | /// </remarks> | 251 | /// </remarks> |
500 | public event UpdateScript OnUpdateScript; | 252 | public event UpdateScript OnUpdateScript; |
501 | 253 | ||
@@ -521,203 +273,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
521 | } | 273 | } |
522 | 274 | ||
523 | /// <summary> | 275 | /// <summary> |
524 | /// Triggered when some scene object properties change. | ||
525 | /// </summary> | ||
526 | /// <remarks> | ||
527 | /// ScriptChangedEvent is fired when a scene object property that a script might be interested | 276 | /// ScriptChangedEvent is fired when a scene object property that a script might be interested |
528 | /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. | 277 | /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. |
529 | /// This is not an indication that the script has changed (see OnUpdateScript for that). | 278 | /// This is not an indication that the script has changed (see OnUpdateScript for that). |
530 | /// This event is sent to a script to tell it that some property changed on | 279 | /// This event is sent to a script to tell it that some property changed on |
531 | /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . | 280 | /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . |
532 | /// Triggered by <see cref="TriggerOnScriptChangedEvent"/> | 281 | /// </summary> |
533 | /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.TeleportAgentWithinRegion"/>, | ||
534 | /// <see cref="SceneObjectPart.TriggerScriptChangedEvent"/> | ||
535 | /// </remarks> | ||
536 | public event ScriptChangedEvent OnScriptChangedEvent; | 282 | public event ScriptChangedEvent OnScriptChangedEvent; |
537 | public delegate void ScriptChangedEvent(uint localID, uint change); | 283 | public delegate void ScriptChangedEvent(uint localID, uint change); |
538 | 284 | ||
539 | public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); | 285 | public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); |
540 | |||
541 | /// <summary> | ||
542 | /// Triggered when a script receives control input from an agent. | ||
543 | /// </summary> | ||
544 | /// <remarks> | ||
545 | /// Triggered by <see cref="TriggerControlEvent"/> | ||
546 | /// in <see cref="ScenePresence.SendControlsToScripts"/> | ||
547 | /// via <see cref="ScenePresence.HandleAgentUpdate"/> | ||
548 | /// via <see cref="OpenSim.Framework.IClientAPI.OnAgentUpdate"/> | ||
549 | /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleAgentUpdate"/> | ||
550 | /// </remarks> | ||
551 | public event ScriptControlEvent OnScriptControlEvent; | 286 | public event ScriptControlEvent OnScriptControlEvent; |
552 | 287 | ||
553 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); | 288 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); |
554 | |||
555 | /// <summary> | ||
556 | /// Triggered when an object has arrived within a tolerance distance | ||
557 | /// of a motion target. | ||
558 | /// </summary> | ||
559 | /// <remarks> | ||
560 | /// Triggered by <see cref="TriggerAtTargetEvent"/> | ||
561 | /// in <see cref="SceneObjectGroup.checkAtTargets"/> | ||
562 | /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>, | ||
563 | /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/> | ||
564 | /// </remarks> | ||
565 | public event ScriptAtTargetEvent OnScriptAtTargetEvent; | 289 | public event ScriptAtTargetEvent OnScriptAtTargetEvent; |
566 | 290 | ||
567 | public delegate void ScriptNotAtTargetEvent(uint localID); | 291 | public delegate void ScriptNotAtTargetEvent(uint localID); |
568 | |||
569 | /// <summary> | ||
570 | /// Triggered when an object has a motion target but has not arrived | ||
571 | /// within a tolerance distance. | ||
572 | /// </summary> | ||
573 | /// <remarks> | ||
574 | /// Triggered by <see cref="TriggerNotAtTargetEvent"/> | ||
575 | /// in <see cref="SceneObjectGroup.checkAtTargets"/> | ||
576 | /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>, | ||
577 | /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/> | ||
578 | /// </remarks> | ||
579 | public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; | 292 | public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; |
580 | 293 | ||
581 | public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); | 294 | public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); |
582 | |||
583 | /// <summary> | ||
584 | /// Triggered when an object has arrived within a tolerance rotation | ||
585 | /// of a rotation target. | ||
586 | /// </summary> | ||
587 | /// <remarks> | ||
588 | /// Triggered by <see cref="TriggerAtRotTargetEvent"/> | ||
589 | /// in <see cref="SceneObjectGroup.checkAtTargets"/> | ||
590 | /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>, | ||
591 | /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/> | ||
592 | /// </remarks> | ||
593 | public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; | 295 | public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; |
594 | 296 | ||
595 | public delegate void ScriptNotAtRotTargetEvent(uint localID); | 297 | public delegate void ScriptNotAtRotTargetEvent(uint localID); |
596 | |||
597 | /// <summary> | ||
598 | /// Triggered when an object has a rotation target but has not arrived | ||
599 | /// within a tolerance rotation. | ||
600 | /// </summary> | ||
601 | /// <remarks> | ||
602 | /// Triggered by <see cref="TriggerNotAtRotTargetEvent"/> | ||
603 | /// in <see cref="SceneObjectGroup.checkAtTargets"/> | ||
604 | /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>, | ||
605 | /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/> | ||
606 | /// </remarks> | ||
607 | public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; | 298 | public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; |
608 | 299 | ||
609 | public delegate void ScriptColliding(uint localID, ColliderArgs colliders); | 300 | public delegate void ScriptColliding(uint localID, ColliderArgs colliders); |
610 | |||
611 | /// <summary> | ||
612 | /// Triggered when a physical collision has started between a prim | ||
613 | /// and something other than the region terrain. | ||
614 | /// </summary> | ||
615 | /// <remarks> | ||
616 | /// Triggered by <see cref="TriggerScriptCollidingStart"/> | ||
617 | /// in <see cref="SceneObjectPart.SendCollisionEvent"/> | ||
618 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
619 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
620 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
621 | /// </remarks> | ||
622 | public event ScriptColliding OnScriptColliderStart; | 301 | public event ScriptColliding OnScriptColliderStart; |
623 | |||
624 | /// <summary> | ||
625 | /// Triggered when something that previously collided with a prim has | ||
626 | /// not stopped colliding with it. | ||
627 | /// </summary> | ||
628 | /// <remarks> | ||
629 | /// <seealso cref="OnScriptColliderStart"/> | ||
630 | /// Triggered by <see cref="TriggerScriptColliding"/> | ||
631 | /// in <see cref="SceneObjectPart.SendCollisionEvent"/> | ||
632 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
633 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
634 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
635 | /// </remarks> | ||
636 | public event ScriptColliding OnScriptColliding; | 302 | public event ScriptColliding OnScriptColliding; |
637 | |||
638 | /// <summary> | ||
639 | /// Triggered when something that previously collided with a prim has | ||
640 | /// stopped colliding with it. | ||
641 | /// </summary> | ||
642 | /// <remarks> | ||
643 | /// Triggered by <see cref="TriggerScriptCollidingEnd"/> | ||
644 | /// in <see cref="SceneObjectPart.SendCollisionEvent"/> | ||
645 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
646 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
647 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
648 | /// </remarks> | ||
649 | public event ScriptColliding OnScriptCollidingEnd; | 303 | public event ScriptColliding OnScriptCollidingEnd; |
650 | |||
651 | /// <summary> | ||
652 | /// Triggered when a physical collision has started between an object | ||
653 | /// and the region terrain. | ||
654 | /// </summary> | ||
655 | /// <remarks> | ||
656 | /// Triggered by <see cref="TriggerScriptLandCollidingStart"/> | ||
657 | /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> | ||
658 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
659 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
660 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
661 | /// </remarks> | ||
662 | public event ScriptColliding OnScriptLandColliderStart; | 304 | public event ScriptColliding OnScriptLandColliderStart; |
663 | |||
664 | /// <summary> | ||
665 | /// Triggered when an object that previously collided with the region | ||
666 | /// terrain has not yet stopped colliding with it. | ||
667 | /// </summary> | ||
668 | /// <remarks> | ||
669 | /// Triggered by <see cref="TriggerScriptLandColliding"/> | ||
670 | /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> | ||
671 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
672 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
673 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
674 | /// </remarks> | ||
675 | public event ScriptColliding OnScriptLandColliding; | 305 | public event ScriptColliding OnScriptLandColliding; |
676 | |||
677 | /// <summary> | ||
678 | /// Triggered when an object that previously collided with the region | ||
679 | /// terrain has stopped colliding with it. | ||
680 | /// </summary> | ||
681 | /// <remarks> | ||
682 | /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/> | ||
683 | /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> | ||
684 | /// via <see cref="SceneObjectPart.PhysicsCollision"/> | ||
685 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> | ||
686 | /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> | ||
687 | /// </remarks> | ||
688 | public event ScriptColliding OnScriptLandColliderEnd; | 306 | public event ScriptColliding OnScriptLandColliderEnd; |
689 | 307 | ||
690 | public delegate void OnMakeChildAgentDelegate(ScenePresence presence); | 308 | public delegate void OnMakeChildAgentDelegate(ScenePresence presence); |
691 | |||
692 | /// <summary> | ||
693 | /// Triggered when an agent has been made a child agent of a scene. | ||
694 | /// </summary> | ||
695 | /// <remarks> | ||
696 | /// Triggered by <see cref="TriggerOnMakeChildAgent"/> | ||
697 | /// in <see cref="ScenePresence.MakeChildAgent"/> | ||
698 | /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CrossAgentToNewRegionAsync"/>, | ||
699 | /// <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>, | ||
700 | /// <see cref="OpenSim.Region.CoreModules.InterGrid.KillAUser.ShutdownNoLogout"/> | ||
701 | /// </remarks> | ||
702 | public event OnMakeChildAgentDelegate OnMakeChildAgent; | 309 | public event OnMakeChildAgentDelegate OnMakeChildAgent; |
703 | 310 | ||
704 | public delegate void OnSaveNewWindlightProfileDelegate(); | 311 | public delegate void OnSaveNewWindlightProfileDelegate(); |
705 | public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); | 312 | public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); |
706 | 313 | ||
707 | /// <summary> | 314 | /// <summary> |
708 | /// Triggered after the grunt work for adding a root agent to a | ||
709 | /// scene has been performed (resuming attachment scripts, physics, | ||
710 | /// animations etc.) | ||
711 | /// </summary> | ||
712 | /// <remarks> | ||
713 | /// This event is on the critical path for transferring an avatar from one region to another. Try and do | 315 | /// This event is on the critical path for transferring an avatar from one region to another. Try and do |
714 | /// as little work on this event as possible, or do work asynchronously. | 316 | /// as little work on this event as possible, or do work asynchronously. |
715 | /// Triggered after <see cref="OnSetRootAgentScene"/> | 317 | /// </summary> |
716 | /// by <see cref="TriggerOnMakeRootAgent"/> | ||
717 | /// in <see cref="ScenePresence.MakeRootAgent"/> | ||
718 | /// via <see cref="Scene.AgentCrossing"/> | ||
719 | /// and <see cref="ScenePresence.CompleteMovement"/> | ||
720 | /// </remarks> | ||
721 | public event Action<ScenePresence> OnMakeRootAgent; | 318 | public event Action<ScenePresence> OnMakeRootAgent; |
722 | 319 | ||
723 | public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; | 320 | public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; |
@@ -743,17 +340,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
743 | public event AvatarKillData OnAvatarKilled; | 340 | public event AvatarKillData OnAvatarKilled; |
744 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | 341 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); |
745 | 342 | ||
746 | /* | 343 | // public delegate void ScriptTimerEvent(uint localID, double timerinterval); |
747 | public delegate void ScriptTimerEvent(uint localID, double timerinterval); | 344 | |
748 | /// <summary> | 345 | // public event ScriptTimerEvent OnScriptTimerEvent; |
749 | /// Used to be triggered when the LSL timer event fires. | ||
750 | /// </summary> | ||
751 | /// <remarks> | ||
752 | /// Triggered by <see cref="TriggerTimerEvent"/> | ||
753 | /// via <see cref="SceneObjectPart.handleTimerAccounting"/> | ||
754 | /// </remarks> | ||
755 | public event ScriptTimerEvent OnScriptTimerEvent; | ||
756 | */ | ||
757 | 346 | ||
758 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 347 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); |
759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 348 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
@@ -763,27 +352,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
763 | /// <summary> | 352 | /// <summary> |
764 | /// Triggered when an object is added to the scene. | 353 | /// Triggered when an object is added to the scene. |
765 | /// </summary> | 354 | /// </summary> |
766 | /// <remarks> | ||
767 | /// Triggered by <see cref="TriggerObjectAddedToScene"/> | ||
768 | /// in <see cref="Scene.AddNewSceneObject"/>, | ||
769 | /// <see cref="Scene.DuplicateObject"/>, | ||
770 | /// <see cref="Scene.doObjectDuplicateOnRay"/> | ||
771 | /// </remarks> | ||
772 | public event Action<SceneObjectGroup> OnObjectAddedToScene; | 355 | public event Action<SceneObjectGroup> OnObjectAddedToScene; |
773 | 356 | ||
774 | /// <summary> | 357 | /// <summary> |
775 | /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> | ||
776 | /// </summary> | ||
777 | /// <param name="obj">The object being removed from the scene</param> | ||
778 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | ||
779 | |||
780 | /// <summary> | ||
781 | /// Triggered when an object is removed from the scene. | 358 | /// Triggered when an object is removed from the scene. |
782 | /// </summary> | 359 | /// </summary> |
783 | /// <remarks> | 360 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
784 | /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/> | ||
785 | /// in <see cref="Scene.DeleteSceneObject"/> | ||
786 | /// </remarks> | ||
787 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | 361 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; |
788 | 362 | ||
789 | public delegate void NoticeNoLandDataFromStorage(); | 363 | public delegate void NoticeNoLandDataFromStorage(); |
@@ -799,20 +373,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
799 | public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate; | 373 | public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate; |
800 | 374 | ||
801 | public delegate void ParcelPrimCountTainted(); | 375 | public delegate void ParcelPrimCountTainted(); |
802 | |||
803 | /// <summary> | ||
804 | /// Triggered when the parcel prim count has been altered. | ||
805 | /// </summary> | ||
806 | /// <remarks> | ||
807 | /// Triggered by <see cref="TriggerParcelPrimCountTainted"/> in | ||
808 | /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.DetachSingleAttachmentToGround"/>, | ||
809 | /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.AttachToAgent"/>, | ||
810 | /// <see cref="Scene.DeleteSceneObject"/>, | ||
811 | /// <see cref="Scene.SelectPrim"/>, | ||
812 | /// <see cref="Scene.DeselectPrim"/>, | ||
813 | /// <see cref="SceneObjectGroup.UpdatePrimFlags"/>, | ||
814 | /// <see cref="SceneObjectGroup.AbsolutePosition"/> | ||
815 | /// </remarks> | ||
816 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; | 376 | public event ParcelPrimCountTainted OnParcelPrimCountTainted; |
817 | public event GetScriptRunning OnGetScriptRunning; | 377 | public event GetScriptRunning OnGetScriptRunning; |
818 | 378 | ||
@@ -876,7 +436,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
876 | /// the scripts may not have started yet | 436 | /// the scripts may not have started yet |
877 | /// Message is non empty string if there were problems loading the oar file | 437 | /// Message is non empty string if there were problems loading the oar file |
878 | /// </summary> | 438 | /// </summary> |
879 | public delegate void OarFileLoaded(Guid guid, List<UUID> loadedScenes, string message); | 439 | public delegate void OarFileLoaded(Guid guid, string message); |
880 | public event OarFileLoaded OnOarFileLoaded; | 440 | public event OarFileLoaded OnOarFileLoaded; |
881 | 441 | ||
882 | /// <summary> | 442 | /// <summary> |
@@ -929,13 +489,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
929 | /// <param name="copy"></param> | 489 | /// <param name="copy"></param> |
930 | /// <param name="original"></param> | 490 | /// <param name="original"></param> |
931 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | 491 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> |
932 | /// <remarks> | ||
933 | /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/> | ||
934 | /// </remarks> | ||
935 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; | 492 | public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; |
936 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | 493 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); |
937 | 494 | ||
938 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop, bool full); | 495 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); |
939 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; | 496 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; |
940 | 497 | ||
941 | public delegate void ScenePresenceUpdated(ScenePresence sp); | 498 | public delegate void ScenePresenceUpdated(ScenePresence sp); |
@@ -973,28 +530,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
973 | public event PrimsLoaded OnPrimsLoaded; | 530 | public event PrimsLoaded OnPrimsLoaded; |
974 | 531 | ||
975 | public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); | 532 | public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); |
976 | |||
977 | /// <summary> | ||
978 | /// Triggered when a teleport starts | ||
979 | /// </summary> | ||
980 | /// <remarks> | ||
981 | /// Triggered by <see cref="TriggerTeleportStart"/> | ||
982 | /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/> | ||
983 | /// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/> | ||
984 | /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/> | ||
985 | /// </remarks> | ||
986 | public event TeleportStart OnTeleportStart; | 533 | public event TeleportStart OnTeleportStart; |
987 | 534 | ||
988 | public delegate void TeleportFail(IClientAPI client, bool gridLogout); | 535 | public delegate void TeleportFail(IClientAPI client, bool gridLogout); |
989 | |||
990 | /// <summary> | ||
991 | /// Trigered when a teleport fails. | ||
992 | /// </summary> | ||
993 | /// <remarks> | ||
994 | /// Triggered by <see cref="TriggerTeleportFail"/> | ||
995 | /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/> | ||
996 | /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/> | ||
997 | /// </remarks> | ||
998 | public event TeleportFail OnTeleportFail; | 536 | public event TeleportFail OnTeleportFail; |
999 | 537 | ||
1000 | public class MoneyTransferArgs : EventArgs | 538 | public class MoneyTransferArgs : EventArgs |
@@ -1002,9 +540,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | public UUID sender; | 540 | public UUID sender; |
1003 | public UUID receiver; | 541 | public UUID receiver; |
1004 | 542 | ||
1005 | /// <summary> | 543 | // Always false. The SL protocol sucks. |
1006 | /// Always false. The SL protocol sucks. | ||
1007 | /// </summary> | ||
1008 | public bool authenticated = false; | 544 | public bool authenticated = false; |
1009 | 545 | ||
1010 | public int amount; | 546 | public int amount; |
@@ -1061,29 +597,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1061 | 597 | ||
1062 | public delegate void LandBuy(Object sender, LandBuyArgs e); | 598 | public delegate void LandBuy(Object sender, LandBuyArgs e); |
1063 | 599 | ||
1064 | /// <summary> | ||
1065 | /// Triggered when an attempt to transfer grid currency occurs | ||
1066 | /// </summary> | ||
1067 | /// <remarks> | ||
1068 | /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/> | ||
1069 | /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/> | ||
1070 | /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/> | ||
1071 | /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> | ||
1072 | /// </remarks> | ||
1073 | public event MoneyTransferEvent OnMoneyTransfer; | 600 | public event MoneyTransferEvent OnMoneyTransfer; |
1074 | |||
1075 | /// <summary> | ||
1076 | /// Triggered after after <see cref="OnValidateLandBuy"/> | ||
1077 | /// </summary> | ||
1078 | public event LandBuy OnLandBuy; | 601 | public event LandBuy OnLandBuy; |
1079 | |||
1080 | /// <summary> | ||
1081 | /// Triggered to allow or prevent a real estate transaction | ||
1082 | /// </summary> | ||
1083 | /// <remarks> | ||
1084 | /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/> | ||
1085 | /// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/> | ||
1086 | /// </remarks> | ||
1087 | public event LandBuy OnValidateLandBuy; | 602 | public event LandBuy OnValidateLandBuy; |
1088 | 603 | ||
1089 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) | 604 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) |
@@ -2520,11 +2035,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2520 | } | 2035 | } |
2521 | } | 2036 | } |
2522 | 2037 | ||
2523 | /// <summary> | 2038 | // this lets us keep track of nasty script events like timer, etc. |
2524 | /// this lets us keep track of nasty script events like timer, etc. | ||
2525 | /// </summary> | ||
2526 | /// <param name="objLocalID"></param> | ||
2527 | /// <param name="Interval"></param> | ||
2528 | public void TriggerTimerEvent(uint objLocalID, double Interval) | 2039 | public void TriggerTimerEvent(uint objLocalID, double Interval) |
2529 | { | 2040 | { |
2530 | throw new NotImplementedException("TriggerTimerEvent was thought to be not used anymore and the registration for the event from scene object part has been commented out due to a memory leak"); | 2041 | throw new NotImplementedException("TriggerTimerEvent was thought to be not used anymore and the registration for the event from scene object part has been commented out due to a memory leak"); |
@@ -2586,7 +2097,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2586 | return 6; | 2097 | return 6; |
2587 | } | 2098 | } |
2588 | 2099 | ||
2589 | public void TriggerOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message) | 2100 | public void TriggerOarFileLoaded(Guid requestId, string message) |
2590 | { | 2101 | { |
2591 | OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; | 2102 | OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; |
2592 | if (handlerOarFileLoaded != null) | 2103 | if (handlerOarFileLoaded != null) |
@@ -2595,7 +2106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | { | 2106 | { |
2596 | try | 2107 | try |
2597 | { | 2108 | { |
2598 | d(requestId, loadedScenes, message); | 2109 | d(requestId, message); |
2599 | } | 2110 | } |
2600 | catch (Exception e) | 2111 | catch (Exception e) |
2601 | { | 2112 | { |
@@ -2880,7 +2391,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2880 | } | 2391 | } |
2881 | } | 2392 | } |
2882 | 2393 | ||
2883 | public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full) | 2394 | public void TriggerSceneObjectPartUpdated(SceneObjectPart sop) |
2884 | { | 2395 | { |
2885 | SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; | 2396 | SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; |
2886 | if (handler != null) | 2397 | if (handler != null) |
@@ -2889,7 +2400,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2889 | { | 2400 | { |
2890 | try | 2401 | try |
2891 | { | 2402 | { |
2892 | d(sop, full); | 2403 | d(sop); |
2893 | } | 2404 | } |
2894 | catch (Exception e) | 2405 | catch (Exception e) |
2895 | { | 2406 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6208a57..906c1ee 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
93 | /// </summary> | 93 | /// </summary> |
94 | public void StartScripts() | 94 | public void StartScripts() |
95 | { | 95 | { |
96 | // m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); | 96 | m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); |
97 | 97 | ||
98 | IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); | 98 | IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); |
99 | 99 | ||
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1469 | return newFolderID; | 1469 | return newFolderID; |
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | public void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) | 1472 | private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) |
1473 | { | 1473 | { |
1474 | if (folder == null) | 1474 | if (folder == null) |
1475 | return; | 1475 | return; |
@@ -1997,9 +1997,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1997 | // If child prims have invalid perms, fix them | 1997 | // If child prims have invalid perms, fix them |
1998 | grp.AdjustChildPrimPermissions(); | 1998 | grp.AdjustChildPrimPermissions(); |
1999 | 1999 | ||
2000 | // If child prims have invalid perms, fix them | ||
2001 | grp.AdjustChildPrimPermissions(); | ||
2002 | |||
2003 | if (remoteClient == null) | 2000 | if (remoteClient == null) |
2004 | { | 2001 | { |
2005 | // Autoreturn has a null client. Nothing else does. So | 2002 | // Autoreturn has a null client. Nothing else does. So |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ce6415a..e970543 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -38,20 +38,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
38 | { | 38 | { |
39 | public partial class Scene | 39 | public partial class Scene |
40 | { | 40 | { |
41 | /// <summary> | ||
42 | /// Send chat to listeners. | ||
43 | /// </summary> | ||
44 | /// <param name='message'></param> | ||
45 | /// <param name='type'>/param> | ||
46 | /// <param name='channel'></param> | ||
47 | /// <param name='fromPos'></param> | ||
48 | /// <param name='fromName'></param> | ||
49 | /// <param name='fromID'></param> | ||
50 | /// <param name='targetID'></param> | ||
51 | /// <param name='fromAgent'></param> | ||
52 | /// <param name='broadcast'></param> | ||
53 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 41 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
54 | UUID fromID, UUID targetID, bool fromAgent, bool broadcast) | 42 | UUID fromID, bool fromAgent, bool broadcast, UUID destination) |
55 | { | 43 | { |
56 | OSChatMessage args = new OSChatMessage(); | 44 | OSChatMessage args = new OSChatMessage(); |
57 | 45 | ||
@@ -61,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | args.Position = fromPos; | 49 | args.Position = fromPos; |
62 | args.SenderUUID = fromID; | 50 | args.SenderUUID = fromID; |
63 | args.Scene = this; | 51 | args.Scene = this; |
64 | args.Destination = targetID; | 52 | args.Destination = destination; |
65 | 53 | ||
66 | if (fromAgent) | 54 | if (fromAgent) |
67 | { | 55 | { |
@@ -78,10 +66,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
78 | args.From = fromName; | 66 | args.From = fromName; |
79 | //args. | 67 | //args. |
80 | 68 | ||
81 | // m_log.DebugFormat( | ||
82 | // "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}", | ||
83 | // args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast); | ||
84 | |||
85 | if (broadcast) | 69 | if (broadcast) |
86 | EventManager.TriggerOnChatBroadcast(this, args); | 70 | EventManager.TriggerOnChatBroadcast(this, args); |
87 | else | 71 | else |
@@ -91,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
91 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 75 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
92 | UUID fromID, bool fromAgent, bool broadcast) | 76 | UUID fromID, bool fromAgent, bool broadcast) |
93 | { | 77 | { |
94 | SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast); | 78 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero); |
95 | } | 79 | } |
96 | 80 | ||
97 | /// <summary> | 81 | /// <summary> |
@@ -559,7 +543,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | if (!InventoryService.AddFolder(folder)) | 543 | if (!InventoryService.AddFolder(folder)) |
560 | { | 544 | { |
561 | m_log.WarnFormat( | 545 | m_log.WarnFormat( |
562 | "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", | 546 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", |
563 | remoteClient.Name, remoteClient.AgentId); | 547 | remoteClient.Name, remoteClient.AgentId); |
564 | } | 548 | } |
565 | } | 549 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2543333..649d545 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -80,11 +80,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | public SynchronizeSceneHandler SynchronizeScene; | 80 | public SynchronizeSceneHandler SynchronizeScene; |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// Used to prevent simultaneous calls to RemoveClient() for the same agent from interfering with each other. | ||
84 | /// </summary> | ||
85 | private object m_removeClientLock = new object(); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Statistical information for this scene. | 83 | /// Statistical information for this scene. |
89 | /// </summary> | 84 | /// </summary> |
90 | public SimStatsReporter StatsReporter { get; private set; } | 85 | public SimStatsReporter StatsReporter { get; private set; } |
@@ -108,31 +103,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
108 | /// </summary> | 103 | /// </summary> |
109 | public bool CollidablePrims { get; private set; } | 104 | public bool CollidablePrims { get; private set; } |
110 | 105 | ||
111 | /// <summary> | ||
112 | /// Minimum value of the size of a non-physical prim in each axis | ||
113 | /// </summary> | ||
114 | public float m_minNonphys = 0.001f; | ||
115 | |||
116 | /// <summary> | ||
117 | /// Maximum value of the size of a non-physical prim in each axis | ||
118 | /// </summary> | ||
119 | public float m_maxNonphys = 256; | 106 | public float m_maxNonphys = 256; |
120 | |||
121 | /// <summary> | ||
122 | /// Minimum value of the size of a physical prim in each axis | ||
123 | /// </summary> | ||
124 | public float m_minPhys = 0.01f; | ||
125 | |||
126 | /// <summary> | ||
127 | /// Maximum value of the size of a physical prim in each axis | ||
128 | /// </summary> | ||
129 | public float m_maxPhys = 10; | 107 | public float m_maxPhys = 10; |
130 | |||
131 | /// <summary> | ||
132 | /// Max prims an object will hold | ||
133 | /// </summary> | ||
134 | public int m_linksetCapacity = 0; | ||
135 | |||
136 | public bool m_clampPrimSize; | 108 | public bool m_clampPrimSize; |
137 | public bool m_trustBinaries; | 109 | public bool m_trustBinaries; |
138 | public bool m_allowScriptCrossings; | 110 | public bool m_allowScriptCrossings; |
@@ -313,31 +285,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | } | 285 | } |
314 | private volatile bool m_shuttingDown; | 286 | private volatile bool m_shuttingDown; |
315 | 287 | ||
316 | /// <summary> | ||
317 | /// Is the scene active? | ||
318 | /// </summary> | ||
319 | /// <remarks> | ||
320 | /// If false, maintenance and update loops are not being run. Updates can still be triggered manually if | ||
321 | /// the scene is not active. | ||
322 | /// </remarks> | ||
323 | public bool Active | ||
324 | { | ||
325 | get { return m_active; } | ||
326 | set | ||
327 | { | ||
328 | if (value) | ||
329 | { | ||
330 | if (!m_active) | ||
331 | Start(); | ||
332 | } | ||
333 | else | ||
334 | { | ||
335 | m_active = false; | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | private volatile bool m_active; | ||
340 | |||
341 | // private int m_lastUpdate; | 288 | // private int m_lastUpdate; |
342 | private bool m_firstHeartbeat = true; | 289 | private bool m_firstHeartbeat = true; |
343 | 290 | ||
@@ -799,24 +746,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
799 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | 746 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
800 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | 747 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
801 | 748 | ||
802 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 749 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); |
803 | if (RegionInfo.NonphysPrimMin > 0) | ||
804 | { | ||
805 | m_minNonphys = RegionInfo.NonphysPrimMin; | ||
806 | } | ||
807 | |||
808 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | ||
809 | if (RegionInfo.NonphysPrimMax > 0) | 750 | if (RegionInfo.NonphysPrimMax > 0) |
810 | { | 751 | { |
811 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 752 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
812 | } | 753 | } |
813 | 754 | ||
814 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | ||
815 | if (RegionInfo.PhysPrimMin > 0) | ||
816 | { | ||
817 | m_minPhys = RegionInfo.PhysPrimMin; | ||
818 | } | ||
819 | |||
820 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 755 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
821 | 756 | ||
822 | if (RegionInfo.PhysPrimMax > 0) | 757 | if (RegionInfo.PhysPrimMax > 0) |
@@ -824,12 +759,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
824 | m_maxPhys = RegionInfo.PhysPrimMax; | 759 | m_maxPhys = RegionInfo.PhysPrimMax; |
825 | } | 760 | } |
826 | 761 | ||
827 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | ||
828 | if (RegionInfo.LinksetCapacity > 0) | ||
829 | { | ||
830 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
831 | } | ||
832 | |||
833 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 762 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
834 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 763 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
835 | 764 | ||
@@ -855,6 +784,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 784 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
856 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | 785 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); |
857 | 786 | ||
787 | IConfig packetConfig = m_config.Configs["PacketPool"]; | ||
788 | if (packetConfig != null) | ||
789 | { | ||
790 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); | ||
791 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); | ||
792 | } | ||
793 | |||
858 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 794 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
859 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | 795 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); |
860 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | 796 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); |
@@ -918,8 +854,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
918 | } | 854 | } |
919 | 855 | ||
920 | // FIXME: Ultimately this should be in a module. | 856 | // FIXME: Ultimately this should be in a module. |
921 | SendPeriodicAppearanceUpdates = true; | ||
922 | |||
923 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | 857 | IConfig appearanceConfig = m_config.Configs["Appearance"]; |
924 | if (appearanceConfig != null) | 858 | if (appearanceConfig != null) |
925 | { | 859 | { |
@@ -1217,14 +1151,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1217 | 1151 | ||
1218 | public void SetSceneCoreDebug(Dictionary<string, string> options) | 1152 | public void SetSceneCoreDebug(Dictionary<string, string> options) |
1219 | { | 1153 | { |
1220 | if (options.ContainsKey("active")) | ||
1221 | { | ||
1222 | bool active; | ||
1223 | |||
1224 | if (bool.TryParse(options["active"], out active)) | ||
1225 | Active = active; | ||
1226 | } | ||
1227 | |||
1228 | if (options.ContainsKey("scripting")) | 1154 | if (options.ContainsKey("scripting")) |
1229 | { | 1155 | { |
1230 | bool enableScripts = true; | 1156 | bool enableScripts = true; |
@@ -1300,12 +1226,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1300 | // This is the method that shuts down the scene. | 1226 | // This is the method that shuts down the scene. |
1301 | public override void Close() | 1227 | public override void Close() |
1302 | { | 1228 | { |
1303 | if (m_shuttingDown) | ||
1304 | { | ||
1305 | m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name); | ||
1306 | return; | ||
1307 | } | ||
1308 | |||
1309 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); | 1229 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); |
1310 | 1230 | ||
1311 | StatsReporter.Close(); | 1231 | StatsReporter.Close(); |
@@ -1352,14 +1272,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1352 | m_log.Debug("[SCENE]: Graph close"); | 1272 | m_log.Debug("[SCENE]: Graph close"); |
1353 | m_sceneGraph.Close(); | 1273 | m_sceneGraph.Close(); |
1354 | 1274 | ||
1355 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | ||
1356 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | ||
1357 | |||
1358 | base.Close(); | ||
1359 | |||
1360 | // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence. | ||
1361 | // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can | ||
1362 | // attempt to reference a null or disposed physics scene. | ||
1363 | if (PhysicsScene != null) | 1275 | if (PhysicsScene != null) |
1364 | { | 1276 | { |
1365 | m_log.Debug("[SCENE]: Dispose Physics"); | 1277 | m_log.Debug("[SCENE]: Dispose Physics"); |
@@ -1369,6 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1369 | phys.Dispose(); | 1281 | phys.Dispose(); |
1370 | phys = null; | 1282 | phys = null; |
1371 | } | 1283 | } |
1284 | |||
1285 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | ||
1286 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | ||
1287 | |||
1288 | // call the base class Close method. | ||
1289 | m_log.Debug("[SCENE]: Base close"); | ||
1290 | base.Close(); | ||
1372 | } | 1291 | } |
1373 | 1292 | ||
1374 | /// <summary> | 1293 | /// <summary> |
@@ -1376,8 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1376 | /// </summary> | 1295 | /// </summary> |
1377 | public void Start() | 1296 | public void Start() |
1378 | { | 1297 | { |
1379 | m_active = true; | ||
1380 | |||
1381 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1298 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1382 | 1299 | ||
1383 | //m_heartbeatTimer.Enabled = true; | 1300 | //m_heartbeatTimer.Enabled = true; |
@@ -1437,7 +1354,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1437 | #region Update Methods | 1354 | #region Update Methods |
1438 | 1355 | ||
1439 | /// <summary> | 1356 | /// <summary> |
1440 | /// Activate the various loops necessary to continually update the scene. | 1357 | /// Performs per-frame updates regularly |
1441 | /// </summary> | 1358 | /// </summary> |
1442 | private void Heartbeat() | 1359 | private void Heartbeat() |
1443 | { | 1360 | { |
@@ -1494,7 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1494 | List<Vector3> coarseLocations; | 1411 | List<Vector3> coarseLocations; |
1495 | List<UUID> avatarUUIDs; | 1412 | List<UUID> avatarUUIDs; |
1496 | 1413 | ||
1497 | while (!m_shuttingDown && ((endRun == null && Active) || MaintenanceRun < endRun)) | 1414 | while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) |
1498 | { | 1415 | { |
1499 | runtc = Util.EnvironmentTickCount(); | 1416 | runtc = Util.EnvironmentTickCount(); |
1500 | ++MaintenanceRun; | 1417 | ++MaintenanceRun; |
@@ -1556,7 +1473,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | int sleepMS; | 1473 | int sleepMS; |
1557 | int framestart; | 1474 | int framestart; |
1558 | 1475 | ||
1559 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1476 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) |
1560 | { | 1477 | { |
1561 | framestart = Util.EnvironmentTickCount(); | 1478 | framestart = Util.EnvironmentTickCount(); |
1562 | ++Frame; | 1479 | ++Frame; |
@@ -1755,19 +1672,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1755 | 1672 | ||
1756 | private void CheckAtTargets() | 1673 | private void CheckAtTargets() |
1757 | { | 1674 | { |
1758 | List<SceneObjectGroup> objs = null; | 1675 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1759 | |||
1760 | lock (m_groupsWithTargets) | 1676 | lock (m_groupsWithTargets) |
1761 | { | 1677 | { |
1762 | if (m_groupsWithTargets.Count != 0) | 1678 | foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) |
1763 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1679 | objs.Add(grp); |
1764 | } | 1680 | } |
1765 | 1681 | ||
1766 | if (objs != null) | 1682 | foreach (SceneObjectGroup entry in objs) |
1767 | { | 1683 | entry.checkAtTargets(); |
1768 | foreach (SceneObjectGroup entry in objs) | ||
1769 | entry.checkAtTargets(); | ||
1770 | } | ||
1771 | } | 1684 | } |
1772 | 1685 | ||
1773 | /// <summary> | 1686 | /// <summary> |
@@ -2280,14 +2193,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2280 | public bool AddRestoredSceneObject( | 2193 | public bool AddRestoredSceneObject( |
2281 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2194 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
2282 | { | 2195 | { |
2283 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2196 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
2284 | { | 2197 | if (result) |
2285 | sceneObject.IsDeleted = false; | 2198 | sceneObject.IsDeleted = false; |
2286 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2199 | return result; |
2287 | return true; | ||
2288 | } | ||
2289 | |||
2290 | return false; | ||
2291 | } | 2200 | } |
2292 | 2201 | ||
2293 | /// <summary> | 2202 | /// <summary> |
@@ -2928,89 +2837,77 @@ namespace OpenSim.Region.Framework.Scenes | |||
2928 | 2837 | ||
2929 | public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) | 2838 | public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) |
2930 | { | 2839 | { |
2931 | ScenePresence sp; | ||
2932 | bool vialogin; | ||
2933 | |||
2934 | // Validation occurs in LLUDPServer | 2840 | // Validation occurs in LLUDPServer |
2935 | // | ||
2936 | // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with | ||
2937 | // each other. In practice, this does not currently occur in the code. | ||
2938 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2841 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2939 | 2842 | ||
2940 | // We lock here on AgentCircuitData to prevent a race condition between the thread adding a new connection | 2843 | bool vialogin |
2941 | // and a simultaneous one that removes it (as can happen if the client is closed at a particular point | 2844 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2942 | // whilst connecting). | 2845 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2943 | // | ||
2944 | // It would be easier to lock across all NewUserConnection(), AddNewClient() and | ||
2945 | // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service | ||
2946 | // response in some module listening to AddNewClient()) from holding up unrelated agent calls. | ||
2947 | // | ||
2948 | // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all | ||
2949 | // AddNewClient() operations (though not other ops). | ||
2950 | // In the future this can be relieved once locking per agent (not necessarily on AgentCircuitData) is improved. | ||
2951 | lock (aCircuit) | ||
2952 | { | ||
2953 | vialogin | ||
2954 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | ||
2955 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | ||
2956 | |||
2957 | CheckHeartbeat(); | ||
2958 | |||
2959 | sp = GetScenePresence(client.AgentId); | ||
2960 | 2846 | ||
2961 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this | 2847 | CheckHeartbeat(); |
2962 | // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause | 2848 | |
2963 | // other problems, and possible the code calling AddNewClient() should ensure that no client is already | 2849 | ScenePresence sp = GetScenePresence(client.AgentId); |
2964 | // connected. | 2850 | |
2965 | if (sp == null) | 2851 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this |
2966 | { | 2852 | // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause |
2967 | m_log.DebugFormat( | 2853 | // other problems, and possible the code calling AddNewClient() should ensure that no client is already |
2968 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | 2854 | // connected. |
2969 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 2855 | if (sp == null) |
2970 | 2856 | { | |
2971 | m_clientManager.Add(client); | 2857 | m_log.DebugFormat( |
2972 | SubscribeToClientEvents(client); | 2858 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2973 | 2859 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | |
2974 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2860 | |
2975 | m_eventManager.TriggerOnNewPresence(sp); | 2861 | m_clientManager.Add(client); |
2976 | 2862 | SubscribeToClientEvents(client); | |
2977 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2863 | |
2978 | 2864 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | |
2979 | // The first agent upon login is a root agent by design. | 2865 | m_eventManager.TriggerOnNewPresence(sp); |
2980 | // For this agent we will have to rez the attachments. | 2866 | |
2981 | // All other AddNewClient calls find aCircuit.child to be true. | 2867 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
2982 | if (aCircuit.child == false) | 2868 | |
2983 | { | 2869 | // The first agent upon login is a root agent by design. |
2984 | // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to | 2870 | // For this agent we will have to rez the attachments. |
2985 | // start the scripts again (since this is done in RezAttachments()). | 2871 | // All other AddNewClient calls find aCircuit.child to be true. |
2986 | // XXX: This is convoluted. | 2872 | if (aCircuit.child == false) |
2987 | sp.IsChildAgent = false; | ||
2988 | |||
2989 | if (AttachmentsModule != null) | ||
2990 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); | ||
2991 | } | ||
2992 | } | ||
2993 | else | ||
2994 | { | 2873 | { |
2995 | m_log.WarnFormat( | 2874 | // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to |
2996 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 2875 | // start the scripts again (since this is done in RezAttachments()). |
2997 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2876 | // XXX: This is convoluted. |
2998 | } | 2877 | sp.IsChildAgent = false; |
2999 | |||
3000 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
3001 | // client is for a root or child agent. | ||
3002 | client.SceneAgent = sp; | ||
3003 | 2878 | ||
3004 | // Cache the user's name | 2879 | if (AttachmentsModule != null) |
3005 | CacheUserName(sp, aCircuit); | 2880 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
3006 | 2881 | } | |
3007 | EventManager.TriggerOnNewClient(client); | 2882 | } |
3008 | if (vialogin) | 2883 | else |
3009 | EventManager.TriggerOnClientLogin(client); | 2884 | { |
2885 | m_log.WarnFormat( | ||
2886 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | ||
2887 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | ||
3010 | } | 2888 | } |
3011 | 2889 | ||
2890 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
2891 | // client is for a root or child agent. | ||
2892 | client.SceneAgent = sp; | ||
2893 | |||
3012 | m_LastLogin = Util.EnvironmentTickCount(); | 2894 | m_LastLogin = Util.EnvironmentTickCount(); |
3013 | 2895 | ||
2896 | // Cache the user's name | ||
2897 | CacheUserName(sp, aCircuit); | ||
2898 | |||
2899 | EventManager.TriggerOnNewClient(client); | ||
2900 | if (vialogin) | ||
2901 | { | ||
2902 | EventManager.TriggerOnClientLogin(client); | ||
2903 | // Send initial parcel data | ||
2904 | /* this is done on TriggerOnNewClient by landmanegement respective event handler | ||
2905 | Vector3 pos = sp.AbsolutePosition; | ||
2906 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2907 | land.SendLandUpdateToClient(client); | ||
2908 | */ | ||
2909 | } | ||
2910 | |||
3014 | return sp; | 2911 | return sp; |
3015 | } | 2912 | } |
3016 | 2913 | ||
@@ -3550,132 +3447,110 @@ namespace OpenSim.Region.Framework.Scenes | |||
3550 | { | 3447 | { |
3551 | // CheckHeartbeat(); | 3448 | // CheckHeartbeat(); |
3552 | bool isChildAgent = false; | 3449 | bool isChildAgent = false; |
3553 | AgentCircuitData acd; | 3450 | ScenePresence avatar = GetScenePresence(agentID); |
3554 | 3451 | ||
3555 | lock (m_removeClientLock) | 3452 | if (avatar == null) |
3556 | { | 3453 | { |
3557 | acd = m_authenticateHandler.GetAgentCircuitData(agentID); | 3454 | m_log.WarnFormat( |
3455 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | ||
3558 | 3456 | ||
3559 | if (acd == null) | 3457 | return; |
3560 | { | ||
3561 | m_log.ErrorFormat("[SCENE]: No agent circuit found for {0}, aborting Scene.RemoveClient", agentID); | ||
3562 | return; | ||
3563 | } | ||
3564 | else | ||
3565 | { | ||
3566 | // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred | ||
3567 | // simultaneously. | ||
3568 | // We also need to remove by agent ID since NPCs will have no circuit code. | ||
3569 | m_authenticateHandler.RemoveCircuit(agentID); | ||
3570 | } | ||
3571 | } | 3458 | } |
3572 | 3459 | ||
3573 | lock (acd) | 3460 | try |
3574 | { | 3461 | { |
3575 | ScenePresence avatar = GetScenePresence(agentID); | 3462 | isChildAgent = avatar.IsChildAgent; |
3576 | |||
3577 | if (avatar == null) | ||
3578 | { | ||
3579 | m_log.WarnFormat( | ||
3580 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | ||
3581 | |||
3582 | return; | ||
3583 | } | ||
3584 | |||
3585 | try | ||
3586 | { | ||
3587 | isChildAgent = avatar.IsChildAgent; | ||
3588 | 3463 | ||
3589 | m_log.DebugFormat( | 3464 | m_log.DebugFormat( |
3590 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | 3465 | "[SCENE]: Removing {0} agent {1} {2} from {3}", |
3591 | (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); | 3466 | (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); |
3592 | 3467 | ||
3593 | // Don't do this to root agents, it's not nice for the viewer | 3468 | // Don't do this to root agents, it's not nice for the viewer |
3594 | if (closeChildAgents && isChildAgent) | 3469 | if (closeChildAgents && isChildAgent) |
3470 | { | ||
3471 | // Tell a single agent to disconnect from the region. | ||
3472 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | ||
3473 | if (eq != null) | ||
3595 | { | 3474 | { |
3596 | // Tell a single agent to disconnect from the region. | 3475 | eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); |
3597 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | ||
3598 | if (eq != null) | ||
3599 | { | ||
3600 | eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); | ||
3601 | } | ||
3602 | else | ||
3603 | { | ||
3604 | avatar.ControllingClient.SendShutdownConnectionNotice(); | ||
3605 | } | ||
3606 | } | 3476 | } |
3607 | 3477 | else | |
3608 | // Only applies to root agents. | ||
3609 | if (avatar.ParentID != 0) | ||
3610 | { | 3478 | { |
3611 | avatar.StandUp(); | 3479 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3612 | } | 3480 | } |
3613 | 3481 | } | |
3614 | m_sceneGraph.removeUserCount(!isChildAgent); | 3482 | |
3615 | 3483 | // Only applies to root agents. | |
3616 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3484 | if (avatar.ParentID != 0) |
3617 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3485 | { |
3618 | if (closeChildAgents && CapsModule != null) | 3486 | avatar.StandUp(); |
3619 | CapsModule.RemoveCaps(agentID); | 3487 | } |
3620 | 3488 | ||
3621 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3489 | m_sceneGraph.removeUserCount(!isChildAgent); |
3622 | // // this method is doing is HORRIBLE!!! | 3490 | |
3623 | // Commented pending deletion since this method no longer appears to do anything at all | 3491 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3624 | // avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3492 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3625 | 3493 | if (closeChildAgents && CapsModule != null) | |
3626 | if (closeChildAgents && !isChildAgent) | 3494 | CapsModule.RemoveCaps(agentID); |
3495 | |||
3496 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | ||
3497 | // this method is doing is HORRIBLE!!! | ||
3498 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | ||
3499 | |||
3500 | if (closeChildAgents && !isChildAgent) | ||
3501 | { | ||
3502 | List<ulong> regions = avatar.KnownRegionHandles; | ||
3503 | regions.Remove(RegionInfo.RegionHandle); | ||
3504 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | ||
3505 | } | ||
3506 | |||
3507 | m_eventManager.TriggerClientClosed(agentID, this); | ||
3508 | m_eventManager.TriggerOnRemovePresence(agentID); | ||
3509 | |||
3510 | if (!isChildAgent) | ||
3511 | { | ||
3512 | if (AttachmentsModule != null) | ||
3627 | { | 3513 | { |
3628 | List<ulong> regions = avatar.KnownRegionHandles; | 3514 | AttachmentsModule.DeRezAttachments(avatar); |
3629 | regions.Remove(RegionInfo.RegionHandle); | ||
3630 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | ||
3631 | } | 3515 | } |
3632 | 3516 | ||
3633 | m_eventManager.TriggerClientClosed(agentID, this); | 3517 | ForEachClient( |
3634 | m_eventManager.TriggerOnRemovePresence(agentID); | 3518 | delegate(IClientAPI client) |
3635 | |||
3636 | if (!isChildAgent) | ||
3637 | { | ||
3638 | if (AttachmentsModule != null) | ||
3639 | { | 3519 | { |
3640 | AttachmentsModule.DeRezAttachments(avatar); | 3520 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3641 | } | 3521 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } |
3522 | catch (NullReferenceException) { } | ||
3523 | }); | ||
3524 | } | ||
3642 | 3525 | ||
3643 | ForEachClient( | 3526 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3644 | delegate(IClientAPI client) | 3527 | if (AgentTransactionsModule != null) |
3645 | { | 3528 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3646 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3529 | |
3647 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } | 3530 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3648 | catch (NullReferenceException) { } | 3531 | m_log.Debug("[Scene] The avatar has left the building"); |
3649 | }); | 3532 | } |
3650 | } | 3533 | catch (Exception e) |
3534 | { | ||
3535 | m_log.Error( | ||
3536 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); | ||
3537 | } | ||
3538 | finally | ||
3539 | { | ||
3540 | try | ||
3541 | { | ||
3542 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | ||
3543 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | ||
3544 | // the same cleanup exception continually. | ||
3545 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3546 | m_clientManager.Remove(agentID); | ||
3651 | 3547 | ||
3652 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3548 | avatar.Close(); |
3653 | if (AgentTransactionsModule != null) | ||
3654 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | ||
3655 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3656 | } | 3549 | } |
3657 | catch (Exception e) | 3550 | catch (Exception e) |
3658 | { | 3551 | { |
3659 | m_log.Error( | 3552 | m_log.Error( |
3660 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); | 3553 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); |
3661 | } | ||
3662 | finally | ||
3663 | { | ||
3664 | try | ||
3665 | { | ||
3666 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | ||
3667 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | ||
3668 | // the same cleanup exception continually. | ||
3669 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3670 | m_clientManager.Remove(agentID); | ||
3671 | |||
3672 | avatar.Close(); | ||
3673 | } | ||
3674 | catch (Exception e) | ||
3675 | { | ||
3676 | m_log.Error( | ||
3677 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); | ||
3678 | } | ||
3679 | } | 3554 | } |
3680 | } | 3555 | } |
3681 | 3556 | ||
@@ -3734,9 +3609,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3734 | 3609 | ||
3735 | /// <summary> | 3610 | /// <summary> |
3736 | /// Do the work necessary to initiate a new user connection for a particular scene. | 3611 | /// Do the work necessary to initiate a new user connection for a particular scene. |
3612 | /// At the moment, this consists of setting up the caps infrastructure | ||
3613 | /// The return bool should allow for connections to be refused, but as not all calling paths | ||
3614 | /// take proper notice of it let, we allowed banned users in still. | ||
3737 | /// </summary> | 3615 | /// </summary> |
3738 | /// <param name="agent">CircuitData of the agent who is connecting</param> | 3616 | /// <param name="agent">CircuitData of the agent who is connecting</param> |
3739 | /// <param name="teleportFlags"></param> | ||
3740 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3617 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3741 | /// <returns>True if the region accepts this agent. False if it does not. False will | 3618 | /// <returns>True if the region accepts this agent. False if it does not. False will |
3742 | /// also return a reason.</returns> | 3619 | /// also return a reason.</returns> |
@@ -3747,20 +3624,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3747 | 3624 | ||
3748 | /// <summary> | 3625 | /// <summary> |
3749 | /// Do the work necessary to initiate a new user connection for a particular scene. | 3626 | /// Do the work necessary to initiate a new user connection for a particular scene. |
3750 | /// </summary> | 3627 | /// At the moment, this consists of setting up the caps infrastructure |
3751 | /// <remarks> | ||
3752 | /// The return bool should allow for connections to be refused, but as not all calling paths | ||
3753 | /// take proper notice of it yet, we still allowed banned users in. | ||
3754 | /// | ||
3755 | /// At the moment this method consists of setting up the caps infrastructure | ||
3756 | /// The return bool should allow for connections to be refused, but as not all calling paths | 3628 | /// The return bool should allow for connections to be refused, but as not all calling paths |
3757 | /// take proper notice of it let, we allowed banned users in still. | 3629 | /// take proper notice of it let, we allowed banned users in still. |
3758 | /// | 3630 | /// </summary> |
3759 | /// This method is called by the login service (in the case of login) or another simulator (in the case of region | ||
3760 | /// cross or teleport) to initiate the connection. It is not triggered by the viewer itself - the connection | ||
3761 | /// is activated later when the viewer sends the initial UseCircuitCodePacket UDP packet (in the case of | ||
3762 | /// the LLUDP stack). | ||
3763 | /// </remarks> | ||
3764 | /// <param name="agent">CircuitData of the agent who is connecting</param> | 3631 | /// <param name="agent">CircuitData of the agent who is connecting</param> |
3765 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3632 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3766 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC | 3633 | /// <param name="requirePresenceLookup">True for normal presence. False for NPC |
@@ -3859,86 +3726,83 @@ namespace OpenSim.Region.Framework.Scenes | |||
3859 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3726 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3860 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3727 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3861 | 3728 | ||
3862 | sp.ControllingClient.Close(true, true); | 3729 | sp.ControllingClient.Close(); |
3863 | sp = null; | 3730 | sp = null; |
3864 | } | 3731 | } |
3865 | 3732 | ||
3866 | lock (agent) | 3733 | |
3734 | //On login test land permisions | ||
3735 | if (vialogin) | ||
3867 | { | 3736 | { |
3868 | //On login test land permisions | 3737 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3869 | if (vialogin) | 3738 | if (cache != null) |
3739 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3740 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3870 | { | 3741 | { |
3871 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); | 3742 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); |
3872 | if (cache != null) | 3743 | return false; |
3873 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3874 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3875 | { | ||
3876 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3877 | return false; | ||
3878 | } | ||
3879 | } | 3744 | } |
3745 | } | ||
3880 | 3746 | ||
3881 | if (sp == null) // We don't have an [child] agent here already | 3747 | if (sp == null) // We don't have an [child] agent here already |
3748 | { | ||
3749 | if (requirePresenceLookup) | ||
3882 | { | 3750 | { |
3883 | if (requirePresenceLookup) | ||
3884 | { | ||
3885 | try | ||
3886 | { | ||
3887 | if (!VerifyUserPresence(agent, out reason)) | ||
3888 | return false; | ||
3889 | } catch (Exception e) | ||
3890 | { | ||
3891 | m_log.ErrorFormat( | ||
3892 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | ||
3893 | return false; | ||
3894 | } | ||
3895 | } | ||
3896 | |||
3897 | try | 3751 | try |
3898 | { | 3752 | { |
3899 | // Always check estate if this is a login. Always | 3753 | if (!VerifyUserPresence(agent, out reason)) |
3900 | // check if banned regions are to be blacked out. | 3754 | return false; |
3901 | if (vialogin || (!m_seeIntoBannedRegion)) | 3755 | } catch (Exception e) |
3902 | { | ||
3903 | if (!AuthorizeUser(agent, out reason)) | ||
3904 | return false; | ||
3905 | } | ||
3906 | } | ||
3907 | catch (Exception e) | ||
3908 | { | 3756 | { |
3909 | m_log.ErrorFormat( | 3757 | m_log.ErrorFormat( |
3910 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3758 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3911 | return false; | 3759 | return false; |
3912 | } | 3760 | } |
3761 | } | ||
3913 | 3762 | ||
3914 | m_log.InfoFormat( | 3763 | try |
3915 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3764 | { |
3916 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3765 | // Always check estate if this is a login. Always |
3917 | agent.AgentID, agent.circuitcode); | 3766 | // check if banned regions are to be blacked out. |
3918 | 3767 | if (vialogin || (!m_seeIntoBannedRegion)) | |
3919 | if (CapsModule != null) | ||
3920 | { | 3768 | { |
3921 | CapsModule.SetAgentCapsSeeds(agent); | 3769 | if (!AuthorizeUser(agent, out reason)) |
3922 | CapsModule.CreateCaps(agent.AgentID); | 3770 | return false; |
3923 | } | 3771 | } |
3924 | } | 3772 | } |
3925 | else | 3773 | catch (Exception e) |
3926 | { | 3774 | { |
3927 | // Let the SP know how we got here. This has a lot of interesting | 3775 | m_log.ErrorFormat( |
3928 | // uses down the line. | 3776 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3929 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3777 | return false; |
3778 | } | ||
3930 | 3779 | ||
3931 | if (sp.IsChildAgent) | 3780 | m_log.InfoFormat( |
3932 | { | 3781 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3933 | m_log.DebugFormat( | 3782 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3934 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3783 | agent.AgentID, agent.circuitcode); |
3935 | agent.AgentID, RegionInfo.RegionName); | ||
3936 | 3784 | ||
3937 | sp.AdjustKnownSeeds(); | 3785 | if (CapsModule != null) |
3786 | { | ||
3787 | CapsModule.SetAgentCapsSeeds(agent); | ||
3788 | CapsModule.CreateCaps(agent.AgentID); | ||
3789 | } | ||
3790 | } else | ||
3791 | { | ||
3792 | // Let the SP know how we got here. This has a lot of interesting | ||
3793 | // uses down the line. | ||
3794 | sp.TeleportFlags = (TPFlags)teleportFlags; | ||
3938 | 3795 | ||
3939 | if (CapsModule != null) | 3796 | if (sp.IsChildAgent) |
3940 | CapsModule.SetAgentCapsSeeds(agent); | 3797 | { |
3941 | } | 3798 | m_log.DebugFormat( |
3799 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | ||
3800 | agent.AgentID, RegionInfo.RegionName); | ||
3801 | |||
3802 | sp.AdjustKnownSeeds(); | ||
3803 | |||
3804 | if (CapsModule != null) | ||
3805 | CapsModule.SetAgentCapsSeeds(agent); | ||
3942 | } | 3806 | } |
3943 | } | 3807 | } |
3944 | 3808 | ||
@@ -4369,9 +4233,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4369 | return false; | 4233 | return false; |
4370 | } | 4234 | } |
4371 | 4235 | ||
4372 | // We have to wait until the viewer contacts this region | 4236 | // We have to wait until the viewer contacts this region after receiving EAC. |
4373 | // after receiving the EnableSimulator HTTP Event Queue message. This triggers the viewer to send | 4237 | // That calls AddNewClient, which finally creates the ScenePresence |
4374 | // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. | ||
4375 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 4238 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
4376 | 4239 | ||
4377 | if (childAgentUpdate != null) | 4240 | if (childAgentUpdate != null) |
@@ -4466,18 +4329,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4466 | /// Tell a single agent to disconnect from the region. | 4329 | /// Tell a single agent to disconnect from the region. |
4467 | /// </summary> | 4330 | /// </summary> |
4468 | /// <param name="agentID"></param> | 4331 | /// <param name="agentID"></param> |
4469 | /// <param name="force"> | 4332 | /// <param name="childOnly"></param> |
4470 | /// Force the agent to close even if it might be in the middle of some other operation. You do not want to | 4333 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) |
4471 | /// force unless you are absolutely sure that the agent is dead and a normal close is not working. | ||
4472 | /// </param> | ||
4473 | public bool IncomingCloseAgent(UUID agentID, bool force) | ||
4474 | { | 4334 | { |
4475 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 4335 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
4476 | 4336 | ||
4477 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4337 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4478 | if (presence != null) | 4338 | if (presence != null) |
4479 | { | 4339 | { |
4480 | presence.ControllingClient.Close(force, force); | 4340 | presence.ControllingClient.Close(false); |
4481 | return true; | 4341 | return true; |
4482 | } | 4342 | } |
4483 | 4343 | ||
@@ -4683,16 +4543,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4683 | return LandChannel.GetLandObject(x, y).LandData; | 4543 | return LandChannel.GetLandObject(x, y).LandData; |
4684 | } | 4544 | } |
4685 | 4545 | ||
4686 | /// <summary> | ||
4687 | /// Get LandData by position. | ||
4688 | /// </summary> | ||
4689 | /// <param name="pos"></param> | ||
4690 | /// <returns></returns> | ||
4691 | public LandData GetLandData(Vector3 pos) | ||
4692 | { | ||
4693 | return GetLandData(pos.X, pos.Y); | ||
4694 | } | ||
4695 | |||
4696 | public LandData GetLandData(uint x, uint y) | 4546 | public LandData GetLandData(uint x, uint y) |
4697 | { | 4547 | { |
4698 | m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); | 4548 | m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); |
@@ -4923,24 +4773,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4923 | /// Get a group via its UUID | 4773 | /// Get a group via its UUID |
4924 | /// </summary> | 4774 | /// </summary> |
4925 | /// <param name="fullID"></param> | 4775 | /// <param name="fullID"></param> |
4926 | /// <returns>null if no group with that id exists</returns> | 4776 | /// <returns>null if no group with that name exists</returns> |
4927 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) | 4777 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) |
4928 | { | 4778 | { |
4929 | return m_sceneGraph.GetSceneObjectGroup(fullID); | 4779 | return m_sceneGraph.GetSceneObjectGroup(fullID); |
4930 | } | 4780 | } |
4931 | 4781 | ||
4932 | /// <summary> | 4782 | /// <summary> |
4933 | /// Get a group via its local ID | ||
4934 | /// </summary> | ||
4935 | /// <remarks>This will only return a group if the local ID matches a root part</remarks> | ||
4936 | /// <param name="localID"></param> | ||
4937 | /// <returns>null if no group with that id exists</returns> | ||
4938 | public SceneObjectGroup GetSceneObjectGroup(uint localID) | ||
4939 | { | ||
4940 | return m_sceneGraph.GetSceneObjectGroup(localID); | ||
4941 | } | ||
4942 | |||
4943 | /// <summary> | ||
4944 | /// Get a group by name from the scene (will return the first | 4783 | /// Get a group by name from the scene (will return the first |
4945 | /// found, if there are more than one prim with the same name) | 4784 | /// found, if there are more than one prim with the same name) |
4946 | /// </summary> | 4785 | /// </summary> |
@@ -4952,18 +4791,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4952 | } | 4791 | } |
4953 | 4792 | ||
4954 | /// <summary> | 4793 | /// <summary> |
4955 | /// Attempt to get the SOG via its UUID | ||
4956 | /// </summary> | ||
4957 | /// <param name="fullID"></param> | ||
4958 | /// <param name="sog"></param> | ||
4959 | /// <returns></returns> | ||
4960 | public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog) | ||
4961 | { | ||
4962 | sog = GetSceneObjectGroup(fullID); | ||
4963 | return sog != null; | ||
4964 | } | ||
4965 | |||
4966 | /// <summary> | ||
4967 | /// Get a prim by name from the scene (will return the first | 4794 | /// Get a prim by name from the scene (will return the first |
4968 | /// found, if there are more than one prim with the same name) | 4795 | /// found, if there are more than one prim with the same name) |
4969 | /// </summary> | 4796 | /// </summary> |
@@ -4995,18 +4822,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4995 | } | 4822 | } |
4996 | 4823 | ||
4997 | /// <summary> | 4824 | /// <summary> |
4998 | /// Attempt to get a prim via its UUID | ||
4999 | /// </summary> | ||
5000 | /// <param name="fullID"></param> | ||
5001 | /// <param name="sop"></param> | ||
5002 | /// <returns></returns> | ||
5003 | public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop) | ||
5004 | { | ||
5005 | sop = GetSceneObjectPart(fullID); | ||
5006 | return sop != null; | ||
5007 | } | ||
5008 | |||
5009 | /// <summary> | ||
5010 | /// Get a scene object group that contains the prim with the given local id | 4825 | /// Get a scene object group that contains the prim with the given local id |
5011 | /// </summary> | 4826 | /// </summary> |
5012 | /// <param name="localID"></param> | 4827 | /// <param name="localID"></param> |
@@ -5100,15 +4915,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5100 | client.SendRegionHandle(regionID, handle); | 4915 | client.SendRegionHandle(regionID, handle); |
5101 | } | 4916 | } |
5102 | 4917 | ||
5103 | // Commented pending deletion since this method no longer appears to do anything at all | 4918 | public bool NeedSceneCacheClear(UUID agentID) |
5104 | // public bool NeedSceneCacheClear(UUID agentID) | 4919 | { |
5105 | // { | 4920 | IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); |
5106 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); | 4921 | if (inv == null) |
5107 | // if (inv == null) | 4922 | return true; |
5108 | // return true; | 4923 | |
5109 | // | 4924 | return inv.NeedSceneCacheClear(agentID, this); |
5110 | // return inv.NeedSceneCacheClear(agentID, this); | 4925 | } |
5111 | // } | ||
5112 | 4926 | ||
5113 | public void CleanTempObjects() | 4927 | public void CleanTempObjects() |
5114 | { | 4928 | { |
@@ -6062,9 +5876,6 @@ Environment.Exit(1); | |||
6062 | 5876 | ||
6063 | public string GetExtraSetting(string name) | 5877 | public string GetExtraSetting(string name) |
6064 | { | 5878 | { |
6065 | if (m_extraSettings == null) | ||
6066 | return String.Empty; | ||
6067 | |||
6068 | string val; | 5879 | string val; |
6069 | 5880 | ||
6070 | if (!m_extraSettings.TryGetValue(name, out val)) | 5881 | if (!m_extraSettings.TryGetValue(name, out val)) |
@@ -6075,9 +5886,6 @@ Environment.Exit(1); | |||
6075 | 5886 | ||
6076 | public void StoreExtraSetting(string name, string val) | 5887 | public void StoreExtraSetting(string name, string val) |
6077 | { | 5888 | { |
6078 | if (m_extraSettings == null) | ||
6079 | return; | ||
6080 | |||
6081 | string oldVal; | 5889 | string oldVal; |
6082 | 5890 | ||
6083 | if (m_extraSettings.TryGetValue(name, out oldVal)) | 5891 | if (m_extraSettings.TryGetValue(name, out oldVal)) |
@@ -6095,9 +5903,6 @@ Environment.Exit(1); | |||
6095 | 5903 | ||
6096 | public void RemoveExtraSetting(string name) | 5904 | public void RemoveExtraSetting(string name) |
6097 | { | 5905 | { |
6098 | if (m_extraSettings == null) | ||
6099 | return; | ||
6100 | |||
6101 | if (!m_extraSettings.ContainsKey(name)) | 5906 | if (!m_extraSettings.ContainsKey(name)) |
6102 | return; | 5907 | return; |
6103 | 5908 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e599e90..af13b46 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -342,7 +342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
342 | public bool AddNewSceneObject( | 342 | public bool AddNewSceneObject( |
343 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) | 343 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
344 | { | 344 | { |
345 | AddNewSceneObject(sceneObject, attachToBackup, false); | 345 | AddNewSceneObject(sceneObject, true, false); |
346 | 346 | ||
347 | if (pos != null) | 347 | if (pos != null) |
348 | sceneObject.AbsolutePosition = (Vector3)pos; | 348 | sceneObject.AbsolutePosition = (Vector3)pos; |
@@ -421,9 +421,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | { | 421 | { |
422 | Vector3 scale = part.Shape.Scale; | 422 | Vector3 scale = part.Shape.Scale; |
423 | 423 | ||
424 | scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X)); | 424 | if (scale.X > m_parentScene.m_maxNonphys) |
425 | scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y)); | 425 | scale.X = m_parentScene.m_maxNonphys; |
426 | scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z)); | 426 | if (scale.Y > m_parentScene.m_maxNonphys) |
427 | scale.Y = m_parentScene.m_maxNonphys; | ||
428 | if (scale.Z > m_parentScene.m_maxNonphys) | ||
429 | scale.Z = m_parentScene.m_maxNonphys; | ||
427 | 430 | ||
428 | part.Shape.Scale = scale; | 431 | part.Shape.Scale = scale; |
429 | } | 432 | } |
@@ -1063,30 +1066,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1063 | } | 1066 | } |
1064 | 1067 | ||
1065 | /// <summary> | 1068 | /// <summary> |
1066 | /// Get a group in the scene | ||
1067 | /// </summary> | ||
1068 | /// <remarks> | ||
1069 | /// This will only return a group if the local ID matches the root part, not other parts. | ||
1070 | /// </remarks> | ||
1071 | /// <param name="localID">Local id of the root part of the group</param> | ||
1072 | /// <returns>null if no such group was found</returns> | ||
1073 | protected internal SceneObjectGroup GetSceneObjectGroup(uint localID) | ||
1074 | { | ||
1075 | lock (SceneObjectGroupsByLocalPartID) | ||
1076 | { | ||
1077 | if (SceneObjectGroupsByLocalPartID.ContainsKey(localID)) | ||
1078 | { | ||
1079 | SceneObjectGroup so = SceneObjectGroupsByLocalPartID[localID]; | ||
1080 | |||
1081 | if (so.LocalId == localID) | ||
1082 | return so; | ||
1083 | } | ||
1084 | } | ||
1085 | |||
1086 | return null; | ||
1087 | } | ||
1088 | |||
1089 | /// <summary> | ||
1090 | /// Get a group by name from the scene (will return the first | 1069 | /// Get a group by name from the scene (will return the first |
1091 | /// found, if there are more than one prim with the same name) | 1070 | /// found, if there are more than one prim with the same name) |
1092 | /// </summary> | 1071 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dba3a61..f1b09ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -92,11 +92,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | private static SceneManager m_instance = null; | 92 | private static SceneManager m_instance = null; |
93 | public static SceneManager Instance | 93 | public static SceneManager Instance |
94 | { | 94 | { |
95 | get { | 95 | get { return m_instance; } |
96 | if (m_instance == null) | ||
97 | m_instance = new SceneManager(); | ||
98 | return m_instance; | ||
99 | } | ||
100 | } | 96 | } |
101 | 97 | ||
102 | private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>(); | 98 | private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 74d2629..ee61de6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2747,25 +2747,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2747 | if (objectGroup == this) | 2747 | if (objectGroup == this) |
2748 | return; | 2748 | return; |
2749 | 2749 | ||
2750 | // If the configured linkset capacity is greater than zero, | ||
2751 | // and the new linkset would have a prim count higher than this | ||
2752 | // value, do not link it. | ||
2753 | if (m_scene.m_linksetCapacity > 0 && | ||
2754 | (PrimCount + objectGroup.PrimCount) > | ||
2755 | m_scene.m_linksetCapacity) | ||
2756 | { | ||
2757 | m_log.DebugFormat( | ||
2758 | "[SCENE OBJECT GROUP]: Cannot link group with root" + | ||
2759 | " part {0}, {1} ({2} prims) to group with root part" + | ||
2760 | " {3}, {4} ({5} prims) because the new linkset" + | ||
2761 | " would exceed the configured maximum of {6}", | ||
2762 | objectGroup.RootPart.Name, objectGroup.RootPart.UUID, | ||
2763 | objectGroup.PrimCount, RootPart.Name, RootPart.UUID, | ||
2764 | PrimCount, m_scene.m_linksetCapacity); | ||
2765 | |||
2766 | return; | ||
2767 | } | ||
2768 | |||
2769 | // 'linkPart' == the root of the group being linked into this group | 2750 | // 'linkPart' == the root of the group being linked into this group |
2770 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 2751 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
2771 | 2752 | ||
@@ -3511,33 +3492,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3511 | /// <param name="scale"></param> | 3492 | /// <param name="scale"></param> |
3512 | public void GroupResize(Vector3 scale) | 3493 | public void GroupResize(Vector3 scale) |
3513 | { | 3494 | { |
3514 | // m_log.DebugFormat( | 3495 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); |
3515 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); | 3496 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); |
3497 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | ||
3516 | 3498 | ||
3517 | PhysicsActor pa = m_rootPart.PhysActor; | 3499 | PhysicsActor pa = m_rootPart.PhysActor; |
3518 | 3500 | ||
3519 | if (Scene != null) | 3501 | if (pa != null && pa.IsPhysical) |
3520 | { | 3502 | { |
3521 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); | 3503 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); |
3522 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); | 3504 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); |
3523 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); | 3505 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); |
3524 | |||
3525 | if (pa != null && pa.IsPhysical) | ||
3526 | { | ||
3527 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); | ||
3528 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); | ||
3529 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); | ||
3530 | } | ||
3531 | } | 3506 | } |
3532 | 3507 | ||
3533 | float x = (scale.X / RootPart.Scale.X); | 3508 | float x = (scale.X / RootPart.Scale.X); |
3534 | float y = (scale.Y / RootPart.Scale.Y); | 3509 | float y = (scale.Y / RootPart.Scale.Y); |
3535 | float z = (scale.Z / RootPart.Scale.Z); | 3510 | float z = (scale.Z / RootPart.Scale.Z); |
3536 | 3511 | ||
3537 | SceneObjectPart[] parts = m_parts.GetArray(); | 3512 | SceneObjectPart[] parts; |
3538 | 3513 | if (x > 1.0f || y > 1.0f || z > 1.0f) | |
3539 | if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f)) | ||
3540 | { | 3514 | { |
3515 | parts = m_parts.GetArray(); | ||
3541 | for (int i = 0; i < parts.Length; i++) | 3516 | for (int i = 0; i < parts.Length; i++) |
3542 | { | 3517 | { |
3543 | SceneObjectPart obPart = parts[i]; | 3518 | SceneObjectPart obPart = parts[i]; |
@@ -3550,7 +3525,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3550 | 3525 | ||
3551 | if (pa != null && pa.IsPhysical) | 3526 | if (pa != null && pa.IsPhysical) |
3552 | { | 3527 | { |
3553 | if (oldSize.X * x > Scene.m_maxPhys) | 3528 | if (oldSize.X * x > m_scene.m_maxPhys) |
3554 | { | 3529 | { |
3555 | f = m_scene.m_maxPhys / oldSize.X; | 3530 | f = m_scene.m_maxPhys / oldSize.X; |
3556 | a = f / x; | 3531 | a = f / x; |
@@ -3558,16 +3533,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3558 | y *= a; | 3533 | y *= a; |
3559 | z *= a; | 3534 | z *= a; |
3560 | } | 3535 | } |
3561 | else if (oldSize.X * x < Scene.m_minPhys) | ||
3562 | { | ||
3563 | f = m_scene.m_minPhys / oldSize.X; | ||
3564 | a = f / x; | ||
3565 | x *= a; | ||
3566 | y *= a; | ||
3567 | z *= a; | ||
3568 | } | ||
3569 | 3536 | ||
3570 | if (oldSize.Y * y > Scene.m_maxPhys) | 3537 | if (oldSize.Y * y > m_scene.m_maxPhys) |
3571 | { | 3538 | { |
3572 | f = m_scene.m_maxPhys / oldSize.Y; | 3539 | f = m_scene.m_maxPhys / oldSize.Y; |
3573 | a = f / y; | 3540 | a = f / y; |
@@ -3575,16 +3542,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3575 | y *= a; | 3542 | y *= a; |
3576 | z *= a; | 3543 | z *= a; |
3577 | } | 3544 | } |
3578 | else if (oldSize.Y * y < Scene.m_minPhys) | ||
3579 | { | ||
3580 | f = m_scene.m_minPhys / oldSize.Y; | ||
3581 | a = f / y; | ||
3582 | x *= a; | ||
3583 | y *= a; | ||
3584 | z *= a; | ||
3585 | } | ||
3586 | 3545 | ||
3587 | if (oldSize.Z * z > Scene.m_maxPhys) | 3546 | if (oldSize.Z * z > m_scene.m_maxPhys) |
3588 | { | 3547 | { |
3589 | f = m_scene.m_maxPhys / oldSize.Z; | 3548 | f = m_scene.m_maxPhys / oldSize.Z; |
3590 | a = f / z; | 3549 | a = f / z; |
@@ -3592,18 +3551,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3592 | y *= a; | 3551 | y *= a; |
3593 | z *= a; | 3552 | z *= a; |
3594 | } | 3553 | } |
3595 | else if (oldSize.Z * z < Scene.m_minPhys) | ||
3596 | { | ||
3597 | f = m_scene.m_minPhys / oldSize.Z; | ||
3598 | a = f / z; | ||
3599 | x *= a; | ||
3600 | y *= a; | ||
3601 | z *= a; | ||
3602 | } | ||
3603 | } | 3554 | } |
3604 | else | 3555 | else |
3605 | { | 3556 | { |
3606 | if (oldSize.X * x > Scene.m_maxNonphys) | 3557 | if (oldSize.X * x > m_scene.m_maxNonphys) |
3607 | { | 3558 | { |
3608 | f = m_scene.m_maxNonphys / oldSize.X; | 3559 | f = m_scene.m_maxNonphys / oldSize.X; |
3609 | a = f / x; | 3560 | a = f / x; |
@@ -3611,16 +3562,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | y *= a; | 3562 | y *= a; |
3612 | z *= a; | 3563 | z *= a; |
3613 | } | 3564 | } |
3614 | else if (oldSize.X * x < Scene.m_minNonphys) | ||
3615 | { | ||
3616 | f = m_scene.m_minNonphys / oldSize.X; | ||
3617 | a = f / x; | ||
3618 | x *= a; | ||
3619 | y *= a; | ||
3620 | z *= a; | ||
3621 | } | ||
3622 | 3565 | ||
3623 | if (oldSize.Y * y > Scene.m_maxNonphys) | 3566 | if (oldSize.Y * y > m_scene.m_maxNonphys) |
3624 | { | 3567 | { |
3625 | f = m_scene.m_maxNonphys / oldSize.Y; | 3568 | f = m_scene.m_maxNonphys / oldSize.Y; |
3626 | a = f / y; | 3569 | a = f / y; |
@@ -3628,16 +3571,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3628 | y *= a; | 3571 | y *= a; |
3629 | z *= a; | 3572 | z *= a; |
3630 | } | 3573 | } |
3631 | else if (oldSize.Y * y < Scene.m_minNonphys) | ||
3632 | { | ||
3633 | f = m_scene.m_minNonphys / oldSize.Y; | ||
3634 | a = f / y; | ||
3635 | x *= a; | ||
3636 | y *= a; | ||
3637 | z *= a; | ||
3638 | } | ||
3639 | 3574 | ||
3640 | if (oldSize.Z * z > Scene.m_maxNonphys) | 3575 | if (oldSize.Z * z > m_scene.m_maxNonphys) |
3641 | { | 3576 | { |
3642 | f = m_scene.m_maxNonphys / oldSize.Z; | 3577 | f = m_scene.m_maxNonphys / oldSize.Z; |
3643 | a = f / z; | 3578 | a = f / z; |
@@ -3645,14 +3580,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3645 | y *= a; | 3580 | y *= a; |
3646 | z *= a; | 3581 | z *= a; |
3647 | } | 3582 | } |
3648 | else if (oldSize.Z * z < Scene.m_minNonphys) | ||
3649 | { | ||
3650 | f = m_scene.m_minNonphys / oldSize.Z; | ||
3651 | a = f / z; | ||
3652 | x *= a; | ||
3653 | y *= a; | ||
3654 | z *= a; | ||
3655 | } | ||
3656 | } | 3583 | } |
3657 | } | 3584 | } |
3658 | } | 3585 | } |
@@ -3665,6 +3592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3665 | 3592 | ||
3666 | RootPart.Resize(prevScale); | 3593 | RootPart.Resize(prevScale); |
3667 | 3594 | ||
3595 | parts = m_parts.GetArray(); | ||
3668 | for (int i = 0; i < parts.Length; i++) | 3596 | for (int i = 0; i < parts.Length; i++) |
3669 | { | 3597 | { |
3670 | SceneObjectPart obPart = parts[i]; | 3598 | SceneObjectPart obPart = parts[i]; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2191cfa..165dd85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -790,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
790 | } | 790 | } |
791 | catch (Exception e) | 791 | catch (Exception e) |
792 | { | 792 | { |
793 | m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e); | 793 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
794 | } | 794 | } |
795 | } | 795 | } |
796 | } | 796 | } |
@@ -2864,35 +2864,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2864 | SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); | 2864 | SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); |
2865 | } | 2865 | } |
2866 | 2866 | ||
2867 | // The Collision sounds code calls this | ||
2868 | public void SendCollisionSound(UUID soundID, double volume, Vector3 position) | ||
2869 | { | ||
2870 | if (soundID == UUID.Zero) | ||
2871 | return; | ||
2872 | |||
2873 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); | ||
2874 | if (soundModule == null) | ||
2875 | return; | ||
2876 | |||
2877 | if (volume > 1) | ||
2878 | volume = 1; | ||
2879 | if (volume < 0) | ||
2880 | volume = 0; | ||
2881 | |||
2882 | int now = Util.EnvironmentTickCount(); | ||
2883 | if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) | ||
2884 | return; | ||
2885 | |||
2886 | LastColSoundSentTime = now; | ||
2887 | |||
2888 | UUID ownerID = OwnerID; | ||
2889 | UUID objectID = ParentGroup.RootPart.UUID; | ||
2890 | UUID parentID = ParentGroup.UUID; | ||
2891 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | ||
2892 | |||
2893 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); | ||
2894 | } | ||
2895 | |||
2896 | public void PhysicsOutOfBounds(Vector3 pos) | 2867 | public void PhysicsOutOfBounds(Vector3 pos) |
2897 | { | 2868 | { |
2898 | m_log.Error("[PHYSICS]: Physical Object went out of bounds."); | 2869 | m_log.Error("[PHYSICS]: Physical Object went out of bounds."); |
@@ -2924,6 +2895,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
2924 | ScheduleTerseUpdate(); | 2895 | ScheduleTerseUpdate(); |
2925 | } | 2896 | } |
2926 | 2897 | ||
2898 | public void PreloadSound(string sound) | ||
2899 | { | ||
2900 | // UUID ownerID = OwnerID; | ||
2901 | UUID objectID = ParentGroup.RootPart.UUID; | ||
2902 | UUID soundID = UUID.Zero; | ||
2903 | |||
2904 | if (!UUID.TryParse(sound, out soundID)) | ||
2905 | { | ||
2906 | //Trys to fetch sound id from prim's inventory. | ||
2907 | //Prim's inventory doesn't support non script items yet | ||
2908 | |||
2909 | TaskInventory.LockItemsForRead(true); | ||
2910 | |||
2911 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2912 | { | ||
2913 | if (item.Value.Name == sound) | ||
2914 | { | ||
2915 | soundID = item.Value.ItemID; | ||
2916 | break; | ||
2917 | } | ||
2918 | } | ||
2919 | |||
2920 | TaskInventory.LockItemsForRead(false); | ||
2921 | } | ||
2922 | |||
2923 | ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
2924 | { | ||
2925 | if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) | ||
2926 | sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
2927 | }); | ||
2928 | } | ||
2929 | |||
2927 | public void RemFlag(PrimFlags flag) | 2930 | public void RemFlag(PrimFlags flag) |
2928 | { | 2931 | { |
2929 | // PrimFlags prevflag = Flags; | 2932 | // PrimFlags prevflag = Flags; |
@@ -2976,20 +2979,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2976 | /// <param name="scale"></param> | 2979 | /// <param name="scale"></param> |
2977 | public void Resize(Vector3 scale) | 2980 | public void Resize(Vector3 scale) |
2978 | { | 2981 | { |
2982 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); | ||
2983 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); | ||
2984 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); | ||
2985 | |||
2979 | PhysicsActor pa = PhysActor; | 2986 | PhysicsActor pa = PhysActor; |
2980 | 2987 | ||
2981 | if (ParentGroup.Scene != null) | 2988 | if (pa != null && pa.IsPhysical) |
2982 | { | 2989 | { |
2983 | scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); | 2990 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); |
2984 | scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); | 2991 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); |
2985 | scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); | 2992 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); |
2986 | |||
2987 | if (pa != null && pa.IsPhysical) | ||
2988 | { | ||
2989 | scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); | ||
2990 | scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); | ||
2991 | scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); | ||
2992 | } | ||
2993 | } | 2993 | } |
2994 | 2994 | ||
2995 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | 2995 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); |
@@ -3086,7 +3086,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3086 | // UUID, Name, TimeStampFull); | 3086 | // UUID, Name, TimeStampFull); |
3087 | 3087 | ||
3088 | if (ParentGroup.Scene != null) | 3088 | if (ParentGroup.Scene != null) |
3089 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true); | 3089 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); |
3090 | } | 3090 | } |
3091 | 3091 | ||
3092 | /// <summary> | 3092 | /// <summary> |
@@ -3120,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3120 | } | 3120 | } |
3121 | 3121 | ||
3122 | if (ParentGroup.Scene != null) | 3122 | if (ParentGroup.Scene != null) |
3123 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false); | 3123 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); |
3124 | } | 3124 | } |
3125 | 3125 | ||
3126 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 3126 | public void ScriptSetPhysicsStatus(bool UsePhysics) |
@@ -3295,6 +3295,126 @@ namespace OpenSim.Region.Framework.Scenes | |||
3295 | } | 3295 | } |
3296 | 3296 | ||
3297 | /// <summary> | 3297 | /// <summary> |
3298 | /// Trigger or play an attached sound in this part's inventory. | ||
3299 | /// </summary> | ||
3300 | /// <param name="sound"></param> | ||
3301 | /// <param name="volume"></param> | ||
3302 | /// <param name="triggered"></param> | ||
3303 | /// <param name="flags"></param> | ||
3304 | public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) | ||
3305 | { | ||
3306 | if (volume > 1) | ||
3307 | volume = 1; | ||
3308 | if (volume < 0) | ||
3309 | volume = 0; | ||
3310 | |||
3311 | UUID ownerID = OwnerID; | ||
3312 | UUID objectID = ParentGroup.RootPart.UUID; | ||
3313 | UUID parentID = ParentGroup.UUID; | ||
3314 | |||
3315 | UUID soundID = UUID.Zero; | ||
3316 | Vector3 position = AbsolutePosition; // region local | ||
3317 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3318 | |||
3319 | if (!UUID.TryParse(sound, out soundID)) | ||
3320 | { | ||
3321 | // search sound file from inventory | ||
3322 | TaskInventory.LockItemsForRead(true); | ||
3323 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3324 | { | ||
3325 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | ||
3326 | { | ||
3327 | soundID = item.Value.ItemID; | ||
3328 | break; | ||
3329 | } | ||
3330 | } | ||
3331 | TaskInventory.LockItemsForRead(false); | ||
3332 | } | ||
3333 | |||
3334 | if (soundID == UUID.Zero) | ||
3335 | return; | ||
3336 | |||
3337 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); | ||
3338 | if (soundModule != null) | ||
3339 | { | ||
3340 | if (useMaster) | ||
3341 | { | ||
3342 | if (isMaster) | ||
3343 | { | ||
3344 | if (triggered) | ||
3345 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3346 | else | ||
3347 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3348 | ParentGroup.PlaySoundMasterPrim = this; | ||
3349 | ownerID = OwnerID; | ||
3350 | objectID = ParentGroup.RootPart.UUID; | ||
3351 | parentID = ParentGroup.UUID; | ||
3352 | position = AbsolutePosition; // region local | ||
3353 | regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3354 | if (triggered) | ||
3355 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3356 | else | ||
3357 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3358 | foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) | ||
3359 | { | ||
3360 | ownerID = prim.OwnerID; | ||
3361 | objectID = prim.ParentGroup.RootPart.UUID; | ||
3362 | parentID = prim.ParentGroup.UUID; | ||
3363 | position = prim.AbsolutePosition; // region local | ||
3364 | regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3365 | if (triggered) | ||
3366 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3367 | else | ||
3368 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3369 | } | ||
3370 | ParentGroup.PlaySoundSlavePrims.Clear(); | ||
3371 | ParentGroup.PlaySoundMasterPrim = null; | ||
3372 | } | ||
3373 | else | ||
3374 | { | ||
3375 | ParentGroup.PlaySoundSlavePrims.Add(this); | ||
3376 | } | ||
3377 | } | ||
3378 | else | ||
3379 | { | ||
3380 | if (triggered) | ||
3381 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3382 | else | ||
3383 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3384 | } | ||
3385 | } | ||
3386 | } | ||
3387 | |||
3388 | public void SendCollisionSound(UUID soundID, double volume, Vector3 position) | ||
3389 | { | ||
3390 | if (soundID == UUID.Zero) | ||
3391 | return; | ||
3392 | |||
3393 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); | ||
3394 | if (soundModule == null) | ||
3395 | return; | ||
3396 | |||
3397 | if (volume > 1) | ||
3398 | volume = 1; | ||
3399 | if (volume < 0) | ||
3400 | volume = 0; | ||
3401 | |||
3402 | int now = Util.EnvironmentTickCount(); | ||
3403 | if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) | ||
3404 | return; | ||
3405 | |||
3406 | LastColSoundSentTime = now; | ||
3407 | |||
3408 | UUID ownerID = OwnerID; | ||
3409 | UUID objectID = ParentGroup.RootPart.UUID; | ||
3410 | UUID parentID = ParentGroup.UUID; | ||
3411 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3412 | |||
3413 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); | ||
3414 | } | ||
3415 | |||
3416 | |||
3417 | /// <summary> | ||
3298 | /// Send a terse update to all clients | 3418 | /// Send a terse update to all clients |
3299 | /// </summary> | 3419 | /// </summary> |
3300 | public void SendTerseUpdateToAllClients() | 3420 | public void SendTerseUpdateToAllClients() |
@@ -3455,32 +3575,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3455 | } | 3575 | } |
3456 | 3576 | ||
3457 | /// <summary> | 3577 | /// <summary> |
3458 | /// Set the color & alpha of prim faces | 3578 | /// Set the color of prim faces |
3459 | /// </summary> | 3579 | /// </summary> |
3460 | /// <param name="face"></param> | ||
3461 | /// <param name="color"></param> | 3580 | /// <param name="color"></param> |
3462 | /// <param name="alpha"></param> | 3581 | /// <param name="face"></param> |
3463 | public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha) | 3582 | public void SetFaceColor(Vector3 color, int face) |
3464 | { | 3583 | { |
3465 | Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); | ||
3466 | float clippedAlpha = alpha.HasValue ? | ||
3467 | Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0; | ||
3468 | |||
3469 | // The only way to get a deep copy/ If we don't do this, we can | 3584 | // The only way to get a deep copy/ If we don't do this, we can |
3470 | // never detect color changes further down. | 3585 | // mever detect color changes further down. |
3471 | Byte[] buf = Shape.Textures.GetBytes(); | 3586 | Byte[] buf = Shape.Textures.GetBytes(); |
3472 | Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); | 3587 | Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); |
3473 | Color4 texcolor; | 3588 | Color4 texcolor; |
3474 | if (face >= 0 && face < GetNumberOfSides()) | 3589 | if (face >= 0 && face < GetNumberOfSides()) |
3475 | { | 3590 | { |
3476 | texcolor = tex.CreateFace((uint)face).RGBA; | 3591 | texcolor = tex.CreateFace((uint)face).RGBA; |
3477 | texcolor.R = clippedColor.X; | 3592 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); |
3478 | texcolor.G = clippedColor.Y; | 3593 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); |
3479 | texcolor.B = clippedColor.Z; | 3594 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); |
3480 | if (alpha.HasValue) | ||
3481 | { | ||
3482 | texcolor.A = clippedAlpha; | ||
3483 | } | ||
3484 | tex.FaceTextures[face].RGBA = texcolor; | 3595 | tex.FaceTextures[face].RGBA = texcolor; |
3485 | UpdateTextureEntry(tex.GetBytes()); | 3596 | UpdateTextureEntry(tex.GetBytes()); |
3486 | return; | 3597 | return; |
@@ -3492,23 +3603,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3492 | if (tex.FaceTextures[i] != null) | 3603 | if (tex.FaceTextures[i] != null) |
3493 | { | 3604 | { |
3494 | texcolor = tex.FaceTextures[i].RGBA; | 3605 | texcolor = tex.FaceTextures[i].RGBA; |
3495 | texcolor.R = clippedColor.X; | 3606 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); |
3496 | texcolor.G = clippedColor.Y; | 3607 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); |
3497 | texcolor.B = clippedColor.Z; | 3608 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); |
3498 | if (alpha.HasValue) | ||
3499 | { | ||
3500 | texcolor.A = clippedAlpha; | ||
3501 | } | ||
3502 | tex.FaceTextures[i].RGBA = texcolor; | 3609 | tex.FaceTextures[i].RGBA = texcolor; |
3503 | } | 3610 | } |
3504 | texcolor = tex.DefaultTexture.RGBA; | 3611 | texcolor = tex.DefaultTexture.RGBA; |
3505 | texcolor.R = clippedColor.X; | 3612 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); |
3506 | texcolor.G = clippedColor.Y; | 3613 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); |
3507 | texcolor.B = clippedColor.Z; | 3614 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); |
3508 | if (alpha.HasValue) | ||
3509 | { | ||
3510 | texcolor.A = clippedAlpha; | ||
3511 | } | ||
3512 | tex.DefaultTexture.RGBA = texcolor; | 3615 | tex.DefaultTexture.RGBA = texcolor; |
3513 | } | 3616 | } |
3514 | UpdateTextureEntry(tex.GetBytes()); | 3617 | UpdateTextureEntry(tex.GetBytes()); |
@@ -4796,57 +4899,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4796 | ScheduleFullUpdate(); | 4899 | ScheduleFullUpdate(); |
4797 | } | 4900 | } |
4798 | 4901 | ||
4799 | public void UpdateSlice(float begin, float end) | ||
4800 | { | ||
4801 | if (end < begin) | ||
4802 | { | ||
4803 | float temp = begin; | ||
4804 | begin = end; | ||
4805 | end = temp; | ||
4806 | } | ||
4807 | end = Math.Min(1f, Math.Max(0f, end)); | ||
4808 | begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f); | ||
4809 | if (begin < 0.02f && end < 0.02f) | ||
4810 | { | ||
4811 | begin = 0f; | ||
4812 | end = 0.02f; | ||
4813 | } | ||
4814 | |||
4815 | ushort uBegin = (ushort)(50000.0 * begin); | ||
4816 | ushort uEnd = (ushort)(50000.0 * (1f - end)); | ||
4817 | bool updatePossiblyNeeded = false; | ||
4818 | PrimType primType = GetPrimType(); | ||
4819 | if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING) | ||
4820 | { | ||
4821 | if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd) | ||
4822 | { | ||
4823 | m_shape.ProfileBegin = uBegin; | ||
4824 | m_shape.ProfileEnd = uEnd; | ||
4825 | updatePossiblyNeeded = true; | ||
4826 | } | ||
4827 | } | ||
4828 | else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd) | ||
4829 | { | ||
4830 | m_shape.PathBegin = uBegin; | ||
4831 | m_shape.PathEnd = uEnd; | ||
4832 | updatePossiblyNeeded = true; | ||
4833 | } | ||
4834 | |||
4835 | if (updatePossiblyNeeded && ParentGroup != null) | ||
4836 | { | ||
4837 | ParentGroup.HasGroupChanged = true; | ||
4838 | } | ||
4839 | if (updatePossiblyNeeded && PhysActor != null) | ||
4840 | { | ||
4841 | PhysActor.Shape = m_shape; | ||
4842 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
4843 | } | ||
4844 | if (updatePossiblyNeeded) | ||
4845 | { | ||
4846 | ScheduleFullUpdate(); | ||
4847 | } | ||
4848 | } | ||
4849 | |||
4850 | /// <summary> | 4902 | /// <summary> |
4851 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics | 4903 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics |
4852 | /// engine can use it. | 4904 | /// engine can use it. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3a9a146..e010864 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -97,15 +97,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
97 | QueryScriptStates(); | 97 | QueryScriptStates(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | |||
101 | public int Count | ||
102 | { | ||
103 | get | ||
104 | { | ||
105 | lock (m_items) | ||
106 | return m_items.Count; | ||
107 | } | ||
108 | } | ||
109 | 100 | ||
110 | /// <summary> | 101 | /// <summary> |
111 | /// Constructor | 102 | /// Constructor |
@@ -244,52 +235,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) | 235 | if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) |
245 | return; | 236 | return; |
246 | 237 | ||
238 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
239 | if (engines == null) // No engine at all | ||
240 | return; | ||
241 | |||
247 | Items.LockItemsForRead(true); | 242 | Items.LockItemsForRead(true); |
248 | foreach (TaskInventoryItem item in Items.Values) | 243 | foreach (TaskInventoryItem item in Items.Values) |
249 | { | 244 | { |
250 | if (item.InvType == (int)InventoryType.LSL) | 245 | if (item.InvType == (int)InventoryType.LSL) |
251 | { | 246 | { |
252 | bool running; | 247 | foreach (IScriptModule e in engines) |
253 | if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running)) | 248 | { |
254 | item.ScriptRunning = running; | 249 | bool running; |
250 | |||
251 | if (e.HasScript(item.ItemID, out running)) | ||
252 | { | ||
253 | item.ScriptRunning = running; | ||
254 | break; | ||
255 | } | ||
256 | } | ||
255 | } | 257 | } |
256 | } | 258 | } |
257 | 259 | ||
258 | Items.LockItemsForRead(false); | 260 | Items.LockItemsForRead(false); |
259 | } | 261 | } |
260 | 262 | ||
261 | public bool TryGetScriptInstanceRunning(UUID itemId, out bool running) | ||
262 | { | ||
263 | running = false; | ||
264 | |||
265 | TaskInventoryItem item = GetInventoryItem(itemId); | ||
266 | |||
267 | if (item == null) | ||
268 | return false; | ||
269 | |||
270 | return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running); | ||
271 | } | ||
272 | |||
273 | public static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running) | ||
274 | { | ||
275 | running = false; | ||
276 | |||
277 | if (item.InvType != (int)InventoryType.LSL) | ||
278 | return false; | ||
279 | |||
280 | IScriptModule[] engines = scene.RequestModuleInterfaces<IScriptModule>(); | ||
281 | if (engines == null) // No engine at all | ||
282 | return false; | ||
283 | |||
284 | foreach (IScriptModule e in engines) | ||
285 | { | ||
286 | if (e.HasScript(item.ItemID, out running)) | ||
287 | return true; | ||
288 | } | ||
289 | |||
290 | return false; | ||
291 | } | ||
292 | |||
293 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 263 | public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
294 | { | 264 | { |
295 | int scriptsValidForStarting = 0; | 265 | int scriptsValidForStarting = 0; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 25a53b4..2b9665c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.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 | * |
@@ -69,15 +69,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
69 | public ScriptControlled eventControls; | 69 | public ScriptControlled eventControls; |
70 | } | 70 | } |
71 | 71 | ||
72 | public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); | 72 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); |
73 | 73 | ||
74 | public class ScenePresence : EntityBase, IScenePresence | 74 | public class ScenePresence : EntityBase, IScenePresence |
75 | { | 75 | { |
76 | // ~ScenePresence() | 76 | // ~ScenePresence() |
77 | // { | 77 | // { |
78 | // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); | 78 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); |
79 | // } | 79 | // } |
80 | |||
81 | private void TriggerScenePresenceUpdated() | 80 | private void TriggerScenePresenceUpdated() |
82 | { | 81 | { |
83 | if (m_scene != null) | 82 | if (m_scene != null) |
@@ -189,7 +188,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | /// </summary> | 188 | /// </summary> |
190 | public bool SitGround { get; private set; } | 189 | public bool SitGround { get; private set; } |
191 | 190 | ||
192 | private SendCoarseLocationsMethod m_sendCoarseLocationsMethod; | 191 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; |
193 | 192 | ||
194 | //private Vector3 m_requestedSitOffset = new Vector3(); | 193 | //private Vector3 m_requestedSitOffset = new Vector3(); |
195 | 194 | ||
@@ -547,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
547 | { | 546 | { |
548 | try | 547 | try |
549 | { | 548 | { |
550 | PhysicsActor.TargetVelocity = value; | 549 | PhysicsActor.Velocity = value; |
551 | } | 550 | } |
552 | catch (Exception e) | 551 | catch (Exception e) |
553 | { | 552 | { |
@@ -712,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
712 | AttachmentsSyncLock = new Object(); | 711 | AttachmentsSyncLock = new Object(); |
713 | AllowMovement = true; | 712 | AllowMovement = true; |
714 | IsChildAgent = true; | 713 | IsChildAgent = true; |
715 | m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; | 714 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
716 | Animator = new ScenePresenceAnimator(this); | 715 | Animator = new ScenePresenceAnimator(this); |
717 | PresenceType = type; | 716 | PresenceType = type; |
718 | DrawDistance = world.DefaultDrawDistance; | 717 | DrawDistance = world.DefaultDrawDistance; |
@@ -976,9 +975,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
976 | { | 975 | { |
977 | if (wasChild && HasAttachments()) | 976 | if (wasChild && HasAttachments()) |
978 | { | 977 | { |
979 | m_log.DebugFormat( | 978 | m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); |
980 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | ||
981 | |||
982 | // Resume scripts | 979 | // Resume scripts |
983 | Util.FireAndForget(delegate(object x) { | 980 | Util.FireAndForget(delegate(object x) { |
984 | foreach (SceneObjectGroup sog in m_attachments) | 981 | foreach (SceneObjectGroup sog in m_attachments) |
@@ -1534,22 +1531,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1534 | bool DCFlagKeyPressed = false; | 1531 | bool DCFlagKeyPressed = false; |
1535 | Vector3 agent_control_v3 = Vector3.Zero; | 1532 | Vector3 agent_control_v3 = Vector3.Zero; |
1536 | 1533 | ||
1537 | bool newFlying = actor.Flying; | 1534 | bool oldflying = Flying; |
1538 | 1535 | ||
1539 | if (ForceFly) | 1536 | if (ForceFly) |
1540 | newFlying = true; | 1537 | actor.Flying = true; |
1541 | else if (FlyDisabled) | 1538 | else if (FlyDisabled) |
1542 | newFlying = false; | 1539 | actor.Flying = false; |
1543 | else | 1540 | else |
1544 | newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1541 | actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1545 | 1542 | ||
1546 | if (actor.Flying != newFlying) | 1543 | if (actor.Flying != oldflying) |
1547 | { | ||
1548 | // Note: ScenePresence.Flying is actually fetched from the physical actor | ||
1549 | // so setting PhysActor.Flying here also sets the ScenePresence's value. | ||
1550 | actor.Flying = newFlying; | ||
1551 | update_movementflag = true; | 1544 | update_movementflag = true; |
1552 | } | ||
1553 | 1545 | ||
1554 | if (ParentID == 0) | 1546 | if (ParentID == 0) |
1555 | { | 1547 | { |
@@ -2631,17 +2623,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2631 | 2623 | ||
2632 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2624 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2633 | { | 2625 | { |
2634 | SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod; | 2626 | SendCourseLocationsMethod d = m_sendCourseLocationsMethod; |
2635 | if (d != null) | 2627 | if (d != null) |
2636 | { | 2628 | { |
2637 | d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); | 2629 | d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); |
2638 | } | 2630 | } |
2639 | } | 2631 | } |
2640 | 2632 | ||
2641 | public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d) | 2633 | public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) |
2642 | { | 2634 | { |
2643 | if (d != null) | 2635 | if (d != null) |
2644 | m_sendCoarseLocationsMethod = d; | 2636 | m_sendCourseLocationsMethod = d; |
2645 | } | 2637 | } |
2646 | 2638 | ||
2647 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2639 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
@@ -2845,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2845 | #region Significant Movement Method | 2837 | #region Significant Movement Method |
2846 | 2838 | ||
2847 | /// <summary> | 2839 | /// <summary> |
2848 | /// This checks for a significant movement and sends a coarselocationchange update | 2840 | /// This checks for a significant movement and sends a courselocationchange update |
2849 | /// </summary> | 2841 | /// </summary> |
2850 | protected void CheckForSignificantMovement() | 2842 | protected void CheckForSignificantMovement() |
2851 | { | 2843 | { |
@@ -3282,7 +3274,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3282 | } | 3274 | } |
3283 | catch { } | 3275 | catch { } |
3284 | cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; | 3276 | cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; |
3285 | cAgent.AnimState = Animator.Animations.ImplicitDefaultAnimation; | ||
3286 | 3277 | ||
3287 | if (Scene.AttachmentsModule != null) | 3278 | if (Scene.AttachmentsModule != null) |
3288 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); | 3279 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); |
@@ -3359,8 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3359 | Animator.Animations.FromArray(cAgent.Anims); | 3350 | Animator.Animations.FromArray(cAgent.Anims); |
3360 | if (cAgent.DefaultAnim != null) | 3351 | if (cAgent.DefaultAnim != null) |
3361 | Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); | 3352 | Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); |
3362 | if (cAgent.AnimState != null) | ||
3363 | Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); | ||
3364 | 3353 | ||
3365 | if (Scene.AttachmentsModule != null) | 3354 | if (Scene.AttachmentsModule != null) |
3366 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 3355 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
@@ -3643,16 +3632,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3643 | public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) | 3632 | public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) |
3644 | { | 3633 | { |
3645 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); | 3634 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); |
3646 | 3635 | ||
3647 | if (attachmentPoint >= 0) | 3636 | lock (m_attachments) |
3648 | { | 3637 | { |
3649 | lock (m_attachments) | 3638 | foreach (SceneObjectGroup so in m_attachments) |
3650 | { | 3639 | { |
3651 | foreach (SceneObjectGroup so in m_attachments) | 3640 | if (attachmentPoint == so.AttachmentPoint) |
3652 | { | 3641 | attachments.Add(so); |
3653 | if (attachmentPoint == so.AttachmentPoint) | ||
3654 | attachments.Add(so); | ||
3655 | } | ||
3656 | } | 3642 | } |
3657 | } | 3643 | } |
3658 | 3644 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 5398ab9..756b1f4 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -47,7 +47,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 47 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; | 49 | public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; |
50 | public const string SlowFramesStatName = "SlowFrames"; | ||
51 | 50 | ||
52 | public delegate void SendStatResult(SimStats stats); | 51 | public delegate void SendStatResult(SimStats stats); |
53 | 52 | ||
@@ -130,16 +129,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | } | 129 | } |
131 | 130 | ||
132 | /// <summary> | 131 | /// <summary> |
133 | /// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME | ||
134 | /// </summary> | ||
135 | public Stat SlowFramesStat { get; private set; } | ||
136 | |||
137 | /// <summary> | ||
138 | /// The threshold at which we log a slow frame. | ||
139 | /// </summary> | ||
140 | public int SlowFramesStatReportThreshold { get; private set; } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Extra sim statistics that are used by monitors but not sent to the client. | 132 | /// Extra sim statistics that are used by monitors but not sent to the client. |
144 | /// </summary> | 133 | /// </summary> |
145 | /// <value> | 134 | /// <value> |
@@ -237,24 +226,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | 226 | ||
238 | if (StatsManager.SimExtraStats != null) | 227 | if (StatsManager.SimExtraStats != null) |
239 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; | 228 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; |
240 | |||
241 | /// 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). | ||
243 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); | ||
244 | |||
245 | SlowFramesStat | ||
246 | = new Stat( | ||
247 | "SlowFrames", | ||
248 | "Slow Frames", | ||
249 | "Number of frames where frame time has been significantly longer than the desired frame time.", | ||
250 | " frames", | ||
251 | "scene", | ||
252 | m_scene.Name, | ||
253 | StatType.Push, | ||
254 | null, | ||
255 | StatVerbosity.Info); | ||
256 | |||
257 | StatsManager.RegisterStat(SlowFramesStat); | ||
258 | } | 229 | } |
259 | 230 | ||
260 | public void Close() | 231 | public void Close() |
@@ -472,7 +443,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
472 | lock (m_lastReportedExtraSimStats) | 443 | lock (m_lastReportedExtraSimStats) |
473 | { | 444 | { |
474 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | 445 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; |
475 | m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; | ||
476 | 446 | ||
477 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | 447 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); |
478 | 448 | ||
@@ -593,11 +563,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
593 | public void addFrameMS(int ms) | 563 | public void addFrameMS(int ms) |
594 | { | 564 | { |
595 | m_frameMS += ms; | 565 | m_frameMS += ms; |
596 | |||
597 | // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
598 | // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern). | ||
599 | if (ms > SlowFramesStatReportThreshold) | ||
600 | SlowFramesStat.Value++; | ||
601 | } | 566 | } |
602 | 567 | ||
603 | public void addNetMS(int ms) | 568 | public void addNetMS(int ms) |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 5faf131..5758869 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
141 | TestScene scene = new SceneHelpers().SetupScene(); | 141 | TestScene scene = new SceneHelpers().SetupScene(); |
142 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 142 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
143 | 143 | ||
144 | scene.IncomingCloseAgent(sp.UUID, false); | 144 | scene.IncomingCloseAgent(sp.UUID); |
145 | 145 | ||
146 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); | 146 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
147 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); | 147 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index ac3da1e..d722a09 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -65,22 +65,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
65 | 65 | ||
66 | Assert.That(scene.Frame, Is.EqualTo(1)); | 66 | Assert.That(scene.Frame, Is.EqualTo(1)); |
67 | } | 67 | } |
68 | |||
69 | [Test] | ||
70 | public void TestShutdownScene() | ||
71 | { | ||
72 | TestHelpers.InMethod(); | ||
73 | |||
74 | Scene scene = new SceneHelpers().SetupScene(); | ||
75 | scene.Close(); | ||
76 | |||
77 | Assert.That(scene.ShuttingDown, Is.True); | ||
78 | Assert.That(scene.Active, Is.False); | ||
79 | |||
80 | // Trying to update a shutdown scene should result in no update | ||
81 | scene.Update(1); | ||
82 | |||
83 | Assert.That(scene.Frame, Is.EqualTo(0)); | ||
84 | } | ||
85 | } | 68 | } |
86 | } \ No newline at end of file | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 9457ebb..44d2d45 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -50,41 +50,9 @@ using OpenSim.Tests.Common.Mock; | |||
50 | namespace OpenSim.Region.Framework.Tests | 50 | namespace OpenSim.Region.Framework.Tests |
51 | { | 51 | { |
52 | [TestFixture] | 52 | [TestFixture] |
53 | public class UserInventoryTests : OpenSimTestCase | 53 | public class UserInventoryTests |
54 | { | 54 | { |
55 | [Test] | 55 | [Test] |
56 | public void TestCreateInventoryFolders() | ||
57 | { | ||
58 | TestHelpers.InMethod(); | ||
59 | // TestHelpers.EnableLogging(); | ||
60 | |||
61 | // For this test both folders will have the same name which is legal in SL user inventories. | ||
62 | string foldersName = "f1"; | ||
63 | |||
64 | Scene scene = new SceneHelpers().SetupScene(); | ||
65 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | ||
66 | |||
67 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | ||
68 | |||
69 | List<InventoryFolderBase> oneFolder | ||
70 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | ||
71 | |||
72 | Assert.That(oneFolder.Count, Is.EqualTo(1)); | ||
73 | InventoryFolderBase firstRetrievedFolder = oneFolder[0]; | ||
74 | Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); | ||
75 | |||
76 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | ||
77 | |||
78 | List<InventoryFolderBase> twoFolders | ||
79 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | ||
80 | |||
81 | Assert.That(twoFolders.Count, Is.EqualTo(2)); | ||
82 | Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName)); | ||
83 | Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName)); | ||
84 | Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID)); | ||
85 | } | ||
86 | |||
87 | [Test] | ||
88 | public void TestGiveInventoryItem() | 56 | public void TestGiveInventoryItem() |
89 | { | 57 | { |
90 | TestHelpers.InMethod(); | 58 | TestHelpers.InMethod(); |
@@ -115,7 +83,7 @@ namespace OpenSim.Region.Framework.Tests | |||
115 | public void TestGiveInventoryFolder() | 83 | public void TestGiveInventoryFolder() |
116 | { | 84 | { |
117 | TestHelpers.InMethod(); | 85 | TestHelpers.InMethod(); |
118 | // TestHelpers.EnableLogging(); | 86 | // log4net.Config.XmlConfigurator.Configure(); |
119 | 87 | ||
120 | Scene scene = new SceneHelpers().SetupScene(); | 88 | Scene scene = new SceneHelpers().SetupScene(); |
121 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 2279e62..411e421 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -52,23 +52,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
52 | public class UuidGatherer | 52 | public class UuidGatherer |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | |||
56 | /// <summary> | ||
57 | /// Asset cache used for gathering assets | ||
58 | /// </summary> | ||
59 | protected IAssetService m_assetCache; | ||
60 | |||
61 | /// <summary> | ||
62 | /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate | ||
63 | /// asset was found by the asset service. | ||
64 | /// </summary> | ||
65 | private AssetBase m_requestedObjectAsset; | ||
55 | 66 | ||
56 | protected IAssetService m_assetService; | 67 | /// <summary> |
57 | 68 | /// Signal whether we are currently waiting for the asset service to deliver an asset. | |
58 | // /// <summary> | 69 | /// </summary> |
59 | // /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate | 70 | private bool m_waitingForObjectAsset; |
60 | // /// asset was found by the asset service. | ||
61 | // /// </summary> | ||
62 | // private AssetBase m_requestedObjectAsset; | ||
63 | // | ||
64 | // /// <summary> | ||
65 | // /// Signal whether we are currently waiting for the asset service to deliver an asset. | ||
66 | // /// </summary> | ||
67 | // private bool m_waitingForObjectAsset; | ||
68 | 71 | ||
69 | public UuidGatherer(IAssetService assetService) | 72 | public UuidGatherer(IAssetService assetCache) |
70 | { | 73 | { |
71 | m_assetService = assetService; | 74 | m_assetCache = assetCache; |
72 | } | 75 | } |
73 | 76 | ||
74 | /// <summary> | 77 | /// <summary> |
@@ -188,18 +191,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | } | 191 | } |
189 | } | 192 | } |
190 | 193 | ||
191 | // /// <summary> | 194 | /// <summary> |
192 | // /// The callback made when we request the asset for an object from the asset service. | 195 | /// The callback made when we request the asset for an object from the asset service. |
193 | // /// </summary> | 196 | /// </summary> |
194 | // private void AssetReceived(string id, Object sender, AssetBase asset) | 197 | private void AssetReceived(string id, Object sender, AssetBase asset) |
195 | // { | 198 | { |
196 | // lock (this) | 199 | lock (this) |
197 | // { | 200 | { |
198 | // m_requestedObjectAsset = asset; | 201 | m_requestedObjectAsset = asset; |
199 | // m_waitingForObjectAsset = false; | 202 | m_waitingForObjectAsset = false; |
200 | // Monitor.Pulse(this); | 203 | Monitor.Pulse(this); |
201 | // } | 204 | } |
202 | // } | 205 | } |
203 | 206 | ||
204 | /// <summary> | 207 | /// <summary> |
205 | /// Get an asset synchronously, potentially using an asynchronous callback. If the | 208 | /// Get an asset synchronously, potentially using an asynchronous callback. If the |
@@ -209,29 +212,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | /// <returns></returns> | 212 | /// <returns></returns> |
210 | protected virtual AssetBase GetAsset(UUID uuid) | 213 | protected virtual AssetBase GetAsset(UUID uuid) |
211 | { | 214 | { |
212 | return m_assetService.Get(uuid.ToString()); | 215 | m_waitingForObjectAsset = true; |
216 | m_assetCache.Get(uuid.ToString(), this, AssetReceived); | ||
217 | |||
218 | // The asset cache callback can either | ||
219 | // | ||
220 | // 1. Complete on the same thread (if the asset is already in the cache) or | ||
221 | // 2. Come in via a different thread (if we need to go fetch it). | ||
222 | // | ||
223 | // The code below handles both these alternatives. | ||
224 | lock (this) | ||
225 | { | ||
226 | if (m_waitingForObjectAsset) | ||
227 | { | ||
228 | Monitor.Wait(this); | ||
229 | m_waitingForObjectAsset = false; | ||
230 | } | ||
231 | } | ||
213 | 232 | ||
214 | // XXX: Switching to do this synchronously where the call was async before but we always waited for it | 233 | return m_requestedObjectAsset; |
215 | // to complete anyway! | ||
216 | // m_waitingForObjectAsset = true; | ||
217 | // m_assetCache.Get(uuid.ToString(), this, AssetReceived); | ||
218 | // | ||
219 | // // The asset cache callback can either | ||
220 | // // | ||
221 | // // 1. Complete on the same thread (if the asset is already in the cache) or | ||
222 | // // 2. Come in via a different thread (if we need to go fetch it). | ||
223 | // // | ||
224 | // // The code below handles both these alternatives. | ||
225 | // lock (this) | ||
226 | // { | ||
227 | // if (m_waitingForObjectAsset) | ||
228 | // { | ||
229 | // Monitor.Wait(this); | ||
230 | // m_waitingForObjectAsset = false; | ||
231 | // } | ||
232 | // } | ||
233 | // | ||
234 | // return m_requestedObjectAsset; | ||
235 | } | 234 | } |
236 | 235 | ||
237 | /// <summary> | 236 | /// <summary> |
@@ -362,47 +361,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
362 | } | 361 | } |
363 | } | 362 | } |
364 | } | 363 | } |
365 | |||
366 | public class HGUuidGatherer : UuidGatherer | ||
367 | { | ||
368 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
369 | |||
370 | protected string m_assetServerURL; | ||
371 | |||
372 | public HGUuidGatherer(IAssetService assetService, string assetServerURL) | ||
373 | : base(assetService) | ||
374 | { | ||
375 | m_assetServerURL = assetServerURL; | ||
376 | if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) | ||
377 | m_assetServerURL = m_assetServerURL + "/"; | ||
378 | } | ||
379 | |||
380 | protected override AssetBase GetAsset(UUID uuid) | ||
381 | { | ||
382 | if (string.Empty == m_assetServerURL) | ||
383 | return base.GetAsset(uuid); | ||
384 | else | ||
385 | return FetchAsset(uuid); | ||
386 | } | ||
387 | |||
388 | public AssetBase FetchAsset(UUID assetID) | ||
389 | { | ||
390 | |||
391 | // Test if it's already here | ||
392 | AssetBase asset = m_assetService.Get(assetID.ToString()); | ||
393 | if (asset == null) | ||
394 | { | ||
395 | // It's not, so fetch it from abroad | ||
396 | asset = m_assetService.Get(m_assetServerURL + assetID.ToString()); | ||
397 | if (asset != null) | ||
398 | m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL); | ||
399 | else | ||
400 | m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL); | ||
401 | } | ||
402 | //else | ||
403 | // m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL); | ||
404 | |||
405 | return asset; | ||
406 | } | ||
407 | } | ||
408 | } | 364 | } |