aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs69
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs71
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUrlModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs501
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs93
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs106
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs115
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs136
17 files changed, 1061 insertions, 132 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
index 8954513..6df5cc2 100644
--- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
@@ -25,6 +25,8 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Drawing;
28using System.IO; 30using System.IO;
29using OpenMetaverse; 31using OpenMetaverse;
30 32
@@ -33,7 +35,14 @@ namespace OpenSim.Region.Framework.Interfaces
33 public interface IDynamicTextureManager 35 public interface IDynamicTextureManager
34 { 36 {
35 void RegisterRender(string handleType, IDynamicTextureRender render); 37 void RegisterRender(string handleType, IDynamicTextureRender render);
36 void ReturnData(UUID id, byte[] data); 38
39 /// <summary>
40 /// Used by IDynamicTextureRender implementations to return renders
41 /// </summary>
42 /// <param name='id'></param>
43 /// <param name='data'></param>
44 /// <param name='isReuseable'></param>
45 void ReturnData(UUID id, IDynamicTexture texture);
37 46
38 UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, 47 UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
39 int updateTimer); 48 int updateTimer);
@@ -113,11 +122,65 @@ namespace OpenSim.Region.Framework.Interfaces
113 string GetName(); 122 string GetName();
114 string GetContentType(); 123 string GetContentType();
115 bool SupportsAsynchronous(); 124 bool SupportsAsynchronous();
116 byte[] ConvertUrl(string url, string extraParams); 125
117 byte[] ConvertStream(Stream data, string extraParams); 126// /// <summary>
127// /// Return true if converting the input body and extra params data will always result in the same byte[] array
128// /// </summary>
129// /// <remarks>
130// /// This method allows the caller to use a previously generated asset if it has one.
131// /// </remarks>
132// /// <returns></returns>
133// /// <param name='bodyData'></param>
134// /// <param name='extraParams'></param>
135// bool AlwaysIdenticalConversion(string bodyData, string extraParams);
136
137 IDynamicTexture ConvertUrl(string url, string extraParams);
138 IDynamicTexture ConvertData(string bodyData, string extraParams);
139
118 bool AsyncConvertUrl(UUID id, string url, string extraParams); 140 bool AsyncConvertUrl(UUID id, string url, string extraParams);
119 bool AsyncConvertData(UUID id, string bodyData, string extraParams); 141 bool AsyncConvertData(UUID id, string bodyData, string extraParams);
142
120 void GetDrawStringSize(string text, string fontName, int fontSize, 143 void GetDrawStringSize(string text, string fontName, int fontSize,
121 out double xSize, out double ySize); 144 out double xSize, out double ySize);
122 } 145 }
146
147 public interface IDynamicTexture
148 {
149 /// <summary>
150 /// Input commands used to generate this data.
151 /// </summary>
152 /// <remarks>
153 /// Null if input commands were not used.
154 /// </remarks>
155 string InputCommands { get; }
156
157 /// <summary>
158 /// Uri used to generate this data.
159 /// </summary>
160 /// <remarks>
161 /// Null if a uri was not used.
162 /// </remarks>
163 Uri InputUri { get; }
164
165 /// <summary>
166 /// Extra input params used to generate this data.
167 /// </summary>
168 string InputParams { get; }
169
170 /// <summary>
171 /// Texture data.
172 /// </summary>
173 byte[] Data { get; }
174
175 /// <summary>
176 /// Size of texture.
177 /// </summary>
178 Size Size { get; }
179
180 /// <summary>
181 /// Signal whether the texture is reuseable (i.e. whether the same input data will always generate the same
182 /// texture).
183 /// </summary>
184 bool IsReuseable { get; }
185 }
123} 186}
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index ca2ad94..292efa4 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -46,6 +46,10 @@ namespace OpenSim.Region.Framework.Interfaces
46 /// </summary> 46 /// </summary>
47 void sendRegionHandshakeToAll(); 47 void sendRegionHandshakeToAll();
48 void TriggerEstateInfoChange(); 48 void TriggerEstateInfoChange();
49
50 /// <summary>
51 /// Fires the OnRegionInfoChange event.
52 /// </summary>
49 void TriggerRegionInfoChange(); 53 void TriggerRegionInfoChange();
50 54
51 void setEstateTerrainBaseTexture(int level, UUID texture); 55 void setEstateTerrainBaseTexture(int level, UUID texture);
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
index baac6e8..da39e95 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IJsonStoreModule 36 public interface IJsonStoreModule
37 { 37 {
38 bool CreateStore(string value, out UUID result); 38 bool CreateStore(string value, ref UUID result);
39 bool DestroyStore(UUID storeID); 39 bool DestroyStore(UUID storeID);
40 bool TestPath(UUID storeID, string path, bool useJson); 40 bool TestPath(UUID storeID, string path, bool useJson);
41 bool SetValue(UUID storeID, string path, string value, bool useJson); 41 bool SetValue(UUID storeID, string path, string value, bool useJson);
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index ed71a95..93930ce 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -46,9 +46,46 @@ namespace OpenSim.Region.Framework.Interfaces
46 /// </summary> 46 /// </summary>
47 event ScriptCommand OnScriptCommand; 47 event ScriptCommand OnScriptCommand;
48 48
49 /// <summary>
50 /// Register an instance method as a script call by method name
51 /// </summary>
52 /// <param name="target"></param>
53 /// <param name="method"></param>
49 void RegisterScriptInvocation(object target, string method); 54 void RegisterScriptInvocation(object target, string method);
55
56 /// <summary>
57 /// Register a static or instance method as a script call by method info
58 /// </summary>
59 /// <param name="target">If target is a Type object, will assume method is static.</param>
60 /// <param name="method"></param>
50 void RegisterScriptInvocation(object target, MethodInfo method); 61 void RegisterScriptInvocation(object target, MethodInfo method);
62
63 /// <summary>
64 /// Register one or more instance methods as script calls by method name
65 /// </summary>
66 /// <param name="target"></param>
67 /// <param name="methods"></param>
51 void RegisterScriptInvocation(object target, string[] methods); 68 void RegisterScriptInvocation(object target, string[] methods);
69
70 /// <summary>
71 /// Register one or more static methods as script calls by method name
72 /// </summary>
73 /// <param name="target"></param>
74 /// <param name="methods"></param>
75 void RegisterScriptInvocation(Type target, string[] methods);
76
77 /// <summary>
78 /// Automatically register script invocations by checking for methods
79 /// with <see cref="ScriptInvocationAttribute"/>. Should only check
80 /// public methods.
81 /// </summary>
82 /// <param name="target"></param>
83 void RegisterScriptInvocations(IRegionModuleBase target);
84
85 /// <summary>
86 /// Returns an array of all registered script calls
87 /// </summary>
88 /// <returns></returns>
52 Delegate[] GetScriptInvocationList(); 89 Delegate[] GetScriptInvocationList();
53 90
54 Delegate LookupScriptInvocation(string fname); 91 Delegate LookupScriptInvocation(string fname);
@@ -67,11 +104,43 @@ namespace OpenSim.Region.Framework.Interfaces
67 /// <param name="key"></param> 104 /// <param name="key"></param>
68 void DispatchReply(UUID scriptId, int code, string text, string key); 105 void DispatchReply(UUID scriptId, int code, string text, string key);
69 106
70 /// For constants 107 /// <summary>
108 /// Operation to for a region module to register a constant to be used
109 /// by the script engine
110 /// </summary>
111 /// <param name="cname">
112 /// The name of the constant. LSL convention is for constant names to
113 /// be uppercase.
114 /// </param>
115 /// <param name="value">
116 /// The value of the constant. Should be of a type that can be
117 /// converted to one of <see cref="OpenSim.Region.ScriptEngine.Shared.LSL_Types"/>
118 /// </param>
71 void RegisterConstant(string cname, object value); 119 void RegisterConstant(string cname, object value);
120
121 /// <summary>
122 /// Automatically register all constants on a region module by
123 /// checking for fields with <see cref="ScriptConstantAttribute"/>.
124 /// </summary>
125 /// <param name="target"></param>
126 void RegisterConstants(IRegionModuleBase target);
127
128 /// <summary>
129 /// Operation to check for a registered constant
130 /// </summary>
131 /// <param name="cname">Name of constant</param>
132 /// <returns>Value of constant or null if none found.</returns>
72 object LookupModConstant(string cname); 133 object LookupModConstant(string cname);
73 134
74 // For use ONLY by the script API 135 // For use ONLY by the script API
75 void RaiseEvent(UUID script, string id, string module, string command, string key); 136 void RaiseEvent(UUID script, string id, string module, string command, string key);
76 } 137 }
138
139 [AttributeUsage(AttributeTargets.Method)]
140 public class ScriptInvocationAttribute : Attribute
141 { }
142
143 [AttributeUsage(AttributeTargets.Field)]
144 public class ScriptConstantAttribute : Attribute
145 { }
77} 146}
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs
index 457444c..79e9f9d 100644
--- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
39 UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); 39 UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID);
40 void ReleaseURL(string url); 40 void ReleaseURL(string url);
41 void HttpResponse(UUID request, int status, string body); 41 void HttpResponse(UUID request, int status, string body);
42 void HttpContentType(UUID request, string type);
43
42 string GetHttpHeader(UUID request, string header); 44 string GetHttpHeader(UUID request, string header);
43 int GetFreeUrls(); 45 int GetFreeUrls();
44 46
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index eee5960..7133817 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -47,30 +47,75 @@ 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>
50 public event OnFrameDelegate OnFrame; 58 public event OnFrameDelegate OnFrame;
51 59
52 public delegate void ClientMovement(ScenePresence client); 60 public delegate void ClientMovement(ScenePresence client);
53 61
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>
54 public event ClientMovement OnClientMovement; 69 public event ClientMovement OnClientMovement;
55 70
56 public delegate void OnTerrainTaintedDelegate(); 71 public delegate void OnTerrainTaintedDelegate();
57 72
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>
58 public event OnTerrainTaintedDelegate OnTerrainTainted; 80 public event OnTerrainTaintedDelegate OnTerrainTainted;
59 81
60 public delegate void OnTerrainTickDelegate(); 82 public delegate void OnTerrainTickDelegate();
61 83
62 public delegate void OnTerrainUpdateDelegate(); 84 /// <summary>
63 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>
64 public event OnTerrainTickDelegate OnTerrainTick; 91 public event OnTerrainTickDelegate OnTerrainTick;
65 92
93 public delegate void OnTerrainUpdateDelegate();
94
66 public event OnTerrainUpdateDelegate OnTerrainUpdate; 95 public event OnTerrainUpdateDelegate OnTerrainUpdate;
67 96
68 public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); 97 public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
69 98
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>
70 public event OnBackupDelegate OnBackup; 106 public event OnBackupDelegate OnBackup;
71 107
72 public delegate void OnClientConnectCoreDelegate(IClientCore client); 108 public delegate void OnClientConnectCoreDelegate(IClientCore client);
73 109
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>
74 public event OnClientConnectCoreDelegate OnClientConnect; 119 public event OnClientConnectCoreDelegate OnClientConnect;
75 120
76 public delegate void OnNewClientDelegate(IClientAPI client); 121 public delegate void OnNewClientDelegate(IClientAPI client);
@@ -91,22 +136,74 @@ namespace OpenSim.Region.Framework.Scenes
91 136
92 public delegate void OnNewPresenceDelegate(ScenePresence presence); 137 public delegate void OnNewPresenceDelegate(ScenePresence presence);
93 138
139 /// <summary>
140 /// Triggered when a new presence is added to the scene
141 /// </summary>
142 /// <remarks>
143 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
144 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
145 /// </remarks>
94 public event OnNewPresenceDelegate OnNewPresence; 146 public event OnNewPresenceDelegate OnNewPresence;
95 147
96 public delegate void OnRemovePresenceDelegate(UUID agentId); 148 public delegate void OnRemovePresenceDelegate(UUID agentId);
97 149
150 /// <summary>
151 /// Triggered when a presence is removed from the scene
152 /// </summary>
153 /// <remarks>
154 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
155 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
156 /// </remarks>
98 public event OnRemovePresenceDelegate OnRemovePresence; 157 public event OnRemovePresenceDelegate OnRemovePresence;
99 158
100 public delegate void OnParcelPrimCountUpdateDelegate(); 159 public delegate void OnParcelPrimCountUpdateDelegate();
101 160
161 /// <summary>
162 /// Triggered whenever the prim count may have been altered, or prior
163 /// to an action that requires the current prim count to be accurate.
164 /// </summary>
165 /// <remarks>
166 /// Triggered by <see cref="TriggerParcelPrimCountUpdate"/> in
167 /// <see cref="OpenSim.OpenSimBase.CreateRegion"/>,
168 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnRequestParcelPrimCountUpdate"/>,
169 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelObjectOwnerRequest"/>,
170 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.GetPrimsFree"/>,
171 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.UpdateLandSold"/>,
172 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.DeedToGroup"/>,
173 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.SendLandUpdateToClient"/>
174 /// </remarks>
102 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 175 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
103 176
104 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); 177 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
105 178
179 /// <summary>
180 /// Triggered in response to <see cref="OnParcelPrimCountUpdate"/> for
181 /// objects that actually contribute to parcel prim count.
182 /// </summary>
183 /// <remarks>
184 /// Triggered by <see cref="TriggerParcelPrimCountAdd"/> in
185 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnParcelPrimCountUpdate"/>
186 /// </remarks>
106 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; 187 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
107 188
108 public delegate void OnPluginConsoleDelegate(string[] args); 189 public delegate void OnPluginConsoleDelegate(string[] args);
109 190
191 /// <summary>
192 /// Triggered after <see cref="OpenSim.IApplicationPlugin.PostInitialise"/>
193 /// has been called for all <see cref="OpenSim.IApplicationPlugin"/>
194 /// loaded via <see cref="OpenSim.OpenSimBase.LoadPlugins"/>.
195 /// Handlers for this event are typically used to parse the arguments
196 /// from <see cref="OnPluginConsoleDelegate"/> in order to process or
197 /// filter the arguments and pass them onto <see cref="OpenSim.Region.CoreModules.Framework.InterfaceCommander.Commander.ProcessConsoleCommand"/>
198 /// </summary>
199 /// <remarks>
200 /// Triggered by <see cref="TriggerOnPluginConsole"/> in
201 /// <see cref="Scene.SendCommandToPlugins"/> via
202 /// <see cref="SceneManager.SendCommandToPluginModules"/> via
203 /// <see cref="OpenSim.OpenSimBase.HandleCommanderCommand"/> via
204 /// <see cref="OpenSim.OpenSimBase.AddPluginCommands"/> via
205 /// <see cref="OpenSim.OpenSimBase.StartupSpecific"/>
206 /// </remarks>
110 public event OnPluginConsoleDelegate OnPluginConsole; 207 public event OnPluginConsoleDelegate OnPluginConsole;
111 208
112 /// <summary> 209 /// <summary>
@@ -121,8 +218,28 @@ namespace OpenSim.Region.Framework.Scenes
121 218
122 public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene); 219 public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
123 220
221 /// <summary>
222 /// Triggered before the grunt work for adding a root agent to a
223 /// scene has been performed (resuming attachment scripts, physics,
224 /// animations etc.)
225 /// </summary>
226 /// <remarks>
227 /// Triggered before <see cref="OnMakeRootAgent"/>
228 /// by <see cref="TriggerSetRootAgentScene"/>
229 /// in <see cref="ScenePresence.MakeRootAgent"/>
230 /// via <see cref="Scene.AgentCrossing"/>
231 /// and <see cref="ScenePresence.CompleteMovement"/>
232 /// </remarks>
124 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 233 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
125 234
235 /// <summary>
236 /// Triggered after parcel properties have been updated.
237 /// </summary>
238 /// <remarks>
239 /// Triggered by <see cref="TriggerOnParcelPropertiesUpdateRequest"/> in
240 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelPropertiesUpdateRequest"/>,
241 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ProcessPropertiesUpdate"/>
242 /// </remarks>
126 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 243 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
127 244
128 /// <summary> 245 /// <summary>
@@ -137,13 +254,45 @@ namespace OpenSim.Region.Framework.Scenes
137 /// <summary> 254 /// <summary>
138 /// Fired when an object is touched/grabbed. 255 /// Fired when an object is touched/grabbed.
139 /// </summary> 256 /// </summary>
257 /// <remarks>
140 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of 258 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
141 /// the root part. 259 /// the root part.
260 /// Triggerd in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
261 /// via <see cref="TriggerObjectGrab"/>
262 /// in <see cref="Scene.ProcessObjectGrab"/>
263 /// </remarks>
142 public event ObjectGrabDelegate OnObjectGrab; 264 public event ObjectGrabDelegate OnObjectGrab;
143 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); 265 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
144 266
267 /// <summary>
268 /// Triggered when an object is being touched/grabbed continuously.
269 /// </summary>
270 /// <remarks>
271 /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabUpdate"/>
272 /// via <see cref="TriggerObjectGrabbing"/>
273 /// in <see cref="Scene.ProcessObjectGrabUpdate"/>
274 /// </remarks>
145 public event ObjectGrabDelegate OnObjectGrabbing; 275 public event ObjectGrabDelegate OnObjectGrabbing;
276
277 /// <summary>
278 /// Triggered when an object stops being touched/grabbed.
279 /// </summary>
280 /// <remarks>
281 /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnDeGrabObject"/>
282 /// via <see cref="TriggerObjectDeGrab"/>
283 /// in <see cref="Scene.ProcessObjectDeGrab"/>
284 /// </remarks>
146 public event ObjectDeGrabDelegate OnObjectDeGrab; 285 public event ObjectDeGrabDelegate OnObjectDeGrab;
286
287 /// <summary>
288 /// Triggered when a script resets.
289 /// </summary>
290 /// <remarks>
291 /// Triggered by <see cref="TriggerScriptReset"/>
292 /// in <see cref="Scene.ProcessScriptReset"/>
293 /// via <see cref="OpenSim.Framework.IClientAPI.OnScriptReset"/>
294 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleScriptReset"/>
295 /// </remarks>
147 public event ScriptResetDelegate OnScriptReset; 296 public event ScriptResetDelegate OnScriptReset;
148 297
149 public event OnPermissionErrorDelegate OnPermissionError; 298 public event OnPermissionErrorDelegate OnPermissionError;
@@ -153,29 +302,105 @@ namespace OpenSim.Region.Framework.Scenes
153 /// </summary> 302 /// </summary>
154 /// <remarks> 303 /// <remarks>
155 /// Occurs after OnNewScript. 304 /// Occurs after OnNewScript.
305 /// Triggered by <see cref="TriggerRezScript"/>
306 /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>
156 /// </remarks> 307 /// </remarks>
157 public event NewRezScript OnRezScript; 308 public event NewRezScript OnRezScript;
158 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); 309 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
159 310
160 public delegate void RemoveScript(uint localID, UUID itemID); 311 public delegate void RemoveScript(uint localID, UUID itemID);
312
313 /// <summary>
314 /// Triggered when a script is removed from an object.
315 /// </summary>
316 /// <remarks>
317 /// Triggered by <see cref="TriggerRemoveScript"/>
318 /// in <see cref="Scene.RemoveTaskInventory"/>,
319 /// <see cref="Scene.CreateAgentInventoryItemFromTask"/>,
320 /// <see cref="SceneObjectPartInventory.RemoveScriptInstance"/>,
321 /// <see cref="SceneObjectPartInventory.RemoveInventoryItem"/>
322 /// </remarks>
161 public event RemoveScript OnRemoveScript; 323 public event RemoveScript OnRemoveScript;
162 324
163 public delegate void StartScript(uint localID, UUID itemID); 325 public delegate void StartScript(uint localID, UUID itemID);
326
327 /// <summary>
328 /// Triggered when a script starts.
329 /// </summary>
330 /// <remarks>
331 /// Triggered by <see cref="TriggerStartScript"/>
332 /// in <see cref="Scene.SetScriptRunning"/>
333 /// via <see cref="OpenSim.Framework.IClientAPI.OnSetScriptRunning"/>,
334 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.HandleSetScriptRunning"/>
335 /// </remarks>
164 public event StartScript OnStartScript; 336 public event StartScript OnStartScript;
165 337
166 public delegate void StopScript(uint localID, UUID itemID); 338 public delegate void StopScript(uint localID, UUID itemID);
339
340 /// <summary>
341 /// Triggered when a script stops.
342 /// </summary>
343 /// <remarks>
344 /// Triggered by <see cref="TriggerStopScript"/>,
345 /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>,
346 /// <see cref="SceneObjectPartInventory.StopScriptInstance"/>,
347 /// <see cref="Scene.SetScriptRunning"/>
348 /// </remarks>
167 public event StopScript OnStopScript; 349 public event StopScript OnStopScript;
168 350
169 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); 351 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
352
353 /// <summary>
354 /// Triggered when an object is moved.
355 /// </summary>
356 /// <remarks>
357 /// Triggered by <see cref="TriggerGroupMove"/>
358 /// in <see cref="SceneObjectGroup.UpdateGroupPosition"/>,
359 /// <see cref="SceneObjectGroup.GrabMovement"/>
360 /// </remarks>
170 public event SceneGroupMoved OnSceneGroupMove; 361 public event SceneGroupMoved OnSceneGroupMove;
171 362
172 public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); 363 public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
364
365 /// <summary>
366 /// Triggered when an object is grabbed.
367 /// </summary>
368 /// <remarks>
369 /// Triggered by <see cref="TriggerGroupGrab"/>
370 /// in <see cref="SceneObjectGroup.OnGrabGroup"/>
371 /// via <see cref="SceneObjectGroup.ObjectGrabHandler"/>
372 /// via <see cref="Scene.ProcessObjectGrab"/>
373 /// via <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
374 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectGrab"/>
375 /// </remarks>
173 public event SceneGroupGrabed OnSceneGroupGrab; 376 public event SceneGroupGrabed OnSceneGroupGrab;
174 377
175 public delegate bool SceneGroupSpinStarted(UUID groupID); 378 public delegate bool SceneGroupSpinStarted(UUID groupID);
379
380 /// <summary>
381 /// Triggered when an object starts to spin.
382 /// </summary>
383 /// <remarks>
384 /// Triggered by <see cref="TriggerGroupSpinStart"/>
385 /// in <see cref="SceneObjectGroup.SpinStart"/>
386 /// via <see cref="SceneGraph.SpinStart"/>
387 /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinStart"/>
388 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinStart"/>
389 /// </remarks>
176 public event SceneGroupSpinStarted OnSceneGroupSpinStart; 390 public event SceneGroupSpinStarted OnSceneGroupSpinStart;
177 391
178 public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); 392 public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
393
394 /// <summary>
395 /// Triggered when an object is being spun.
396 /// </summary>
397 /// <remarks>
398 /// Triggered by <see cref="TriggerGroupSpin"/>
399 /// in <see cref="SceneObjectGroup.SpinMovement"/>
400 /// via <see cref="SceneGraph.SpinObject"/>
401 /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinUpdate"/>
402 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinUpdate"/>
403 /// </remarks>
179 public event SceneGroupSpun OnSceneGroupSpin; 404 public event SceneGroupSpun OnSceneGroupSpin;
180 405
181 public delegate void LandObjectAdded(ILandObject newParcel); 406 public delegate void LandObjectAdded(ILandObject newParcel);
@@ -214,6 +439,9 @@ namespace OpenSim.Region.Framework.Scenes
214 /// </summary> 439 /// </summary>
215 /// <remarks> 440 /// <remarks>
216 /// Occurs before OnRezScript 441 /// Occurs before OnRezScript
442 /// Triggered by <see cref="TriggerNewScript"/>
443 /// in <see cref="Scene.RezScriptFromAgentInventory"/>,
444 /// <see cref="Scene.RezNewScript"/>
217 /// </remarks> 445 /// </remarks>
218 public event NewScript OnNewScript; 446 public event NewScript OnNewScript;
219 447
@@ -248,6 +476,12 @@ namespace OpenSim.Region.Framework.Scenes
248 /// </summary> 476 /// </summary>
249 /// <remarks> 477 /// <remarks>
250 /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. 478 /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
479 /// Triggered by <see cref="TriggerUpdateScript"/>
480 /// in <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
481 /// via <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
482 /// via <see cref="OpenSim.Region.ClientStack.Linden.BunchOfCaps.TaskScriptUpdated"/>
483 /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.OnUpLoad"/>
484 /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.uploaderCaps"/>
251 /// </remarks> 485 /// </remarks>
252 public event UpdateScript OnUpdateScript; 486 public event UpdateScript OnUpdateScript;
253 487
@@ -273,48 +507,203 @@ namespace OpenSim.Region.Framework.Scenes
273 } 507 }
274 508
275 /// <summary> 509 /// <summary>
510 /// Triggered when some scene object properties change.
511 /// </summary>
512 /// <remarks>
276 /// ScriptChangedEvent is fired when a scene object property that a script might be interested 513 /// ScriptChangedEvent is fired when a scene object property that a script might be interested
277 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. 514 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
278 /// This is not an indication that the script has changed (see OnUpdateScript for that). 515 /// This is not an indication that the script has changed (see OnUpdateScript for that).
279 /// This event is sent to a script to tell it that some property changed on 516 /// This event is sent to a script to tell it that some property changed on
280 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . 517 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
281 /// </summary> 518 /// Triggered by <see cref="TriggerOnScriptChangedEvent"/>
519 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.TeleportAgentWithinRegion"/>,
520 /// <see cref="SceneObjectPart.TriggerScriptChangedEvent"/>
521 /// </remarks>
282 public event ScriptChangedEvent OnScriptChangedEvent; 522 public event ScriptChangedEvent OnScriptChangedEvent;
283 public delegate void ScriptChangedEvent(uint localID, uint change); 523 public delegate void ScriptChangedEvent(uint localID, uint change);
284 524
285 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); 525 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
526
527 /// <summary>
528 /// Triggered when a script receives control input from an agent.
529 /// </summary>
530 /// <remarks>
531 /// Triggered by <see cref="TriggerControlEvent"/>
532 /// in <see cref="ScenePresence.SendControlsToScripts"/>
533 /// via <see cref="ScenePresence.HandleAgentUpdate"/>
534 /// via <see cref="OpenSim.Framework.IClientAPI.OnAgentUpdate"/>
535 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleAgentUpdate"/>
536 /// </remarks>
286 public event ScriptControlEvent OnScriptControlEvent; 537 public event ScriptControlEvent OnScriptControlEvent;
287 538
288 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 539 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
540
541 /// <summary>
542 /// Triggered when an object has arrived within a tolerance distance
543 /// of a motion target.
544 /// </summary>
545 /// <remarks>
546 /// Triggered by <see cref="TriggerAtTargetEvent"/>
547 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
548 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
549 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
550 /// </remarks>
289 public event ScriptAtTargetEvent OnScriptAtTargetEvent; 551 public event ScriptAtTargetEvent OnScriptAtTargetEvent;
290 552
291 public delegate void ScriptNotAtTargetEvent(uint localID); 553 public delegate void ScriptNotAtTargetEvent(uint localID);
554
555 /// <summary>
556 /// Triggered when an object has a motion target but has not arrived
557 /// within a tolerance distance.
558 /// </summary>
559 /// <remarks>
560 /// Triggered by <see cref="TriggerNotAtTargetEvent"/>
561 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
562 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
563 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
564 /// </remarks>
292 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 565 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
293 566
294 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); 567 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
568
569 /// <summary>
570 /// Triggered when an object has arrived within a tolerance rotation
571 /// of a rotation target.
572 /// </summary>
573 /// <remarks>
574 /// Triggered by <see cref="TriggerAtRotTargetEvent"/>
575 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
576 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
577 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
578 /// </remarks>
295 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; 579 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
296 580
297 public delegate void ScriptNotAtRotTargetEvent(uint localID); 581 public delegate void ScriptNotAtRotTargetEvent(uint localID);
582
583 /// <summary>
584 /// Triggered when an object has a rotation target but has not arrived
585 /// within a tolerance rotation.
586 /// </summary>
587 /// <remarks>
588 /// Triggered by <see cref="TriggerNotAtRotTargetEvent"/>
589 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
590 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
591 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
592 /// </remarks>
298 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; 593 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
299 594
300 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 595 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
596
597 /// <summary>
598 /// Triggered when a physical collision has started between a prim
599 /// and something other than the region terrain.
600 /// </summary>
601 /// <remarks>
602 /// Triggered by <see cref="TriggerScriptCollidingStart"/>
603 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
604 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
605 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
606 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
607 /// </remarks>
301 public event ScriptColliding OnScriptColliderStart; 608 public event ScriptColliding OnScriptColliderStart;
609
610 /// <summary>
611 /// Triggered when something that previously collided with a prim has
612 /// not stopped colliding with it.
613 /// </summary>
614 /// <remarks>
615 /// <seealso cref="OnScriptColliderStart"/>
616 /// Triggered by <see cref="TriggerScriptColliding"/>
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>
302 public event ScriptColliding OnScriptColliding; 622 public event ScriptColliding OnScriptColliding;
623
624 /// <summary>
625 /// Triggered when something that previously collided with a prim has
626 /// stopped colliding with it.
627 /// </summary>
628 /// <remarks>
629 /// Triggered by <see cref="TriggerScriptCollidingEnd"/>
630 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
631 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
632 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
633 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
634 /// </remarks>
303 public event ScriptColliding OnScriptCollidingEnd; 635 public event ScriptColliding OnScriptCollidingEnd;
636
637 /// <summary>
638 /// Triggered when a physical collision has started between an object
639 /// and the region terrain.
640 /// </summary>
641 /// <remarks>
642 /// Triggered by <see cref="TriggerScriptLandCollidingStart"/>
643 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
644 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
645 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
646 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
647 /// </remarks>
304 public event ScriptColliding OnScriptLandColliderStart; 648 public event ScriptColliding OnScriptLandColliderStart;
649
650 /// <summary>
651 /// Triggered when an object that previously collided with the region
652 /// terrain has not yet stopped colliding with it.
653 /// </summary>
654 /// <remarks>
655 /// Triggered by <see cref="TriggerScriptLandColliding"/>
656 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
657 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
658 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
659 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
660 /// </remarks>
305 public event ScriptColliding OnScriptLandColliding; 661 public event ScriptColliding OnScriptLandColliding;
662
663 /// <summary>
664 /// Triggered when an object that previously collided with the region
665 /// terrain has stopped colliding with it.
666 /// </summary>
667 /// <remarks>
668 /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/>
669 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
670 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
671 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
672 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
673 /// </remarks>
306 public event ScriptColliding OnScriptLandColliderEnd; 674 public event ScriptColliding OnScriptLandColliderEnd;
307 675
308 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 676 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
677
678 /// <summary>
679 /// Triggered when an agent has been made a child agent of a scene.
680 /// </summary>
681 /// <remarks>
682 /// Triggered by <see cref="TriggerOnMakeChildAgent"/>
683 /// in <see cref="ScenePresence.MakeChildAgent"/>
684 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CrossAgentToNewRegionAsync"/>,
685 /// <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>,
686 /// <see cref="OpenSim.Region.CoreModules.InterGrid.KillAUser.ShutdownNoLogout"/>
687 /// </remarks>
309 public event OnMakeChildAgentDelegate OnMakeChildAgent; 688 public event OnMakeChildAgentDelegate OnMakeChildAgent;
310 689
311 public delegate void OnSaveNewWindlightProfileDelegate(); 690 public delegate void OnSaveNewWindlightProfileDelegate();
312 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); 691 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
313 692
314 /// <summary> 693 /// <summary>
694 /// Triggered after the grunt work for adding a root agent to a
695 /// scene has been performed (resuming attachment scripts, physics,
696 /// animations etc.)
697 /// </summary>
698 /// <remarks>
315 /// This event is on the critical path for transferring an avatar from one region to another. Try and do 699 /// This event is on the critical path for transferring an avatar from one region to another. Try and do
316 /// as little work on this event as possible, or do work asynchronously. 700 /// as little work on this event as possible, or do work asynchronously.
317 /// </summary> 701 /// Triggered after <see cref="OnSetRootAgentScene"/>
702 /// by <see cref="TriggerOnMakeRootAgent"/>
703 /// in <see cref="ScenePresence.MakeRootAgent"/>
704 /// via <see cref="Scene.AgentCrossing"/>
705 /// and <see cref="ScenePresence.CompleteMovement"/>
706 /// </remarks>
318 public event Action<ScenePresence> OnMakeRootAgent; 707 public event Action<ScenePresence> OnMakeRootAgent;
319 708
320 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; 709 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
@@ -340,9 +729,17 @@ namespace OpenSim.Region.Framework.Scenes
340 public event AvatarKillData OnAvatarKilled; 729 public event AvatarKillData OnAvatarKilled;
341 public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); 730 public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
342 731
343// public delegate void ScriptTimerEvent(uint localID, double timerinterval); 732 /*
344 733 public delegate void ScriptTimerEvent(uint localID, double timerinterval);
345// public event ScriptTimerEvent OnScriptTimerEvent; 734 /// <summary>
735 /// Used to be triggered when the LSL timer event fires.
736 /// </summary>
737 /// <remarks>
738 /// Triggered by <see cref="TriggerTimerEvent"/>
739 /// via <see cref="SceneObjectPart.handleTimerAccounting"/>
740 /// </remarks>
741 public event ScriptTimerEvent OnScriptTimerEvent;
742 */
346 743
347 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); 744 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
348 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 745 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
@@ -352,12 +749,27 @@ namespace OpenSim.Region.Framework.Scenes
352 /// <summary> 749 /// <summary>
353 /// Triggered when an object is added to the scene. 750 /// Triggered when an object is added to the scene.
354 /// </summary> 751 /// </summary>
752 /// <remarks>
753 /// Triggered by <see cref="TriggerObjectAddedToScene"/>
754 /// in <see cref="Scene.AddNewSceneObject"/>,
755 /// <see cref="Scene.DuplicateObject"/>,
756 /// <see cref="Scene.doObjectDuplicateOnRay"/>
757 /// </remarks>
355 public event Action<SceneObjectGroup> OnObjectAddedToScene; 758 public event Action<SceneObjectGroup> OnObjectAddedToScene;
356 759
357 /// <summary> 760 /// <summary>
358 /// Triggered when an object is removed from the scene. 761 /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
359 /// </summary> 762 /// </summary>
763 /// <param name="obj">The object being removed from the scene</param>
360 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 764 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
765
766 /// <summary>
767 /// Triggered when an object is removed from the scene.
768 /// </summary>
769 /// <remarks>
770 /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
771 /// in <see cref="Scene.DeleteSceneObject"/>
772 /// </remarks>
361 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; 773 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
362 774
363 public delegate void NoticeNoLandDataFromStorage(); 775 public delegate void NoticeNoLandDataFromStorage();
@@ -373,6 +785,20 @@ namespace OpenSim.Region.Framework.Scenes
373 public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate; 785 public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
374 786
375 public delegate void ParcelPrimCountTainted(); 787 public delegate void ParcelPrimCountTainted();
788
789 /// <summary>
790 /// Triggered when the parcel prim count has been altered.
791 /// </summary>
792 /// <remarks>
793 /// Triggered by <see cref="TriggerParcelPrimCountTainted"/> in
794 /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.DetachSingleAttachmentToGround"/>,
795 /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.AttachToAgent"/>,
796 /// <see cref="Scene.DeleteSceneObject"/>,
797 /// <see cref="Scene.SelectPrim"/>,
798 /// <see cref="Scene.DeselectPrim"/>,
799 /// <see cref="SceneObjectGroup.UpdatePrimFlags"/>,
800 /// <see cref="SceneObjectGroup.AbsolutePosition"/>
801 /// </remarks>
376 public event ParcelPrimCountTainted OnParcelPrimCountTainted; 802 public event ParcelPrimCountTainted OnParcelPrimCountTainted;
377 public event GetScriptRunning OnGetScriptRunning; 803 public event GetScriptRunning OnGetScriptRunning;
378 804
@@ -432,7 +858,7 @@ namespace OpenSim.Region.Framework.Scenes
432 /// the scripts may not have started yet 858 /// the scripts may not have started yet
433 /// Message is non empty string if there were problems loading the oar file 859 /// Message is non empty string if there were problems loading the oar file
434 /// </summary> 860 /// </summary>
435 public delegate void OarFileLoaded(Guid guid, string message); 861 public delegate void OarFileLoaded(Guid guid, List<UUID> loadedScenes, string message);
436 public event OarFileLoaded OnOarFileLoaded; 862 public event OarFileLoaded OnOarFileLoaded;
437 863
438 /// <summary> 864 /// <summary>
@@ -485,6 +911,9 @@ namespace OpenSim.Region.Framework.Scenes
485 /// <param name="copy"></param> 911 /// <param name="copy"></param>
486 /// <param name="original"></param> 912 /// <param name="original"></param>
487 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> 913 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
914 /// <remarks>
915 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/>
916 /// </remarks>
488 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; 917 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
489 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); 918 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
490 919
@@ -526,9 +955,28 @@ namespace OpenSim.Region.Framework.Scenes
526 public event PrimsLoaded OnPrimsLoaded; 955 public event PrimsLoaded OnPrimsLoaded;
527 956
528 public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); 957 public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
958
959 /// <summary>
960 /// Triggered when a teleport starts
961 /// </summary>
962 /// <remarks>
963 /// Triggered by <see cref="TriggerTeleportStart"/>
964 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/>
965 /// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/>
966 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
967 /// </remarks>
529 public event TeleportStart OnTeleportStart; 968 public event TeleportStart OnTeleportStart;
530 969
531 public delegate void TeleportFail(IClientAPI client, bool gridLogout); 970 public delegate void TeleportFail(IClientAPI client, bool gridLogout);
971
972 /// <summary>
973 /// Trigered when a teleport fails.
974 /// </summary>
975 /// <remarks>
976 /// Triggered by <see cref="TriggerTeleportFail"/>
977 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/>
978 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
979 /// </remarks>
532 public event TeleportFail OnTeleportFail; 980 public event TeleportFail OnTeleportFail;
533 981
534 public class MoneyTransferArgs : EventArgs 982 public class MoneyTransferArgs : EventArgs
@@ -536,7 +984,9 @@ namespace OpenSim.Region.Framework.Scenes
536 public UUID sender; 984 public UUID sender;
537 public UUID receiver; 985 public UUID receiver;
538 986
539 // Always false. The SL protocol sucks. 987 /// <summary>
988 /// Always false. The SL protocol sucks.
989 /// </summary>
540 public bool authenticated = false; 990 public bool authenticated = false;
541 991
542 public int amount; 992 public int amount;
@@ -593,8 +1043,29 @@ namespace OpenSim.Region.Framework.Scenes
593 1043
594 public delegate void LandBuy(Object sender, LandBuyArgs e); 1044 public delegate void LandBuy(Object sender, LandBuyArgs e);
595 1045
1046 /// <summary>
1047 /// Triggered when an attempt to transfer grid currency occurs
1048 /// </summary>
1049 /// <remarks>
1050 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
1051 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
1052 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
1053 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/>
1054 /// </remarks>
596 public event MoneyTransferEvent OnMoneyTransfer; 1055 public event MoneyTransferEvent OnMoneyTransfer;
1056
1057 /// <summary>
1058 /// Triggered after after <see cref="OnValidateLandBuy"/>
1059 /// </summary>
597 public event LandBuy OnLandBuy; 1060 public event LandBuy OnLandBuy;
1061
1062 /// <summary>
1063 /// Triggered to allow or prevent a real estate transaction
1064 /// </summary>
1065 /// <remarks>
1066 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/>
1067 /// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/>
1068 /// </remarks>
598 public event LandBuy OnValidateLandBuy; 1069 public event LandBuy OnValidateLandBuy;
599 1070
600 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) 1071 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
@@ -2031,7 +2502,11 @@ namespace OpenSim.Region.Framework.Scenes
2031 } 2502 }
2032 } 2503 }
2033 2504
2034 // this lets us keep track of nasty script events like timer, etc. 2505 /// <summary>
2506 /// this lets us keep track of nasty script events like timer, etc.
2507 /// </summary>
2508 /// <param name="objLocalID"></param>
2509 /// <param name="Interval"></param>
2035 public void TriggerTimerEvent(uint objLocalID, double Interval) 2510 public void TriggerTimerEvent(uint objLocalID, double Interval)
2036 { 2511 {
2037 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"); 2512 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");
@@ -2093,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes
2093 return 6; 2568 return 6;
2094 } 2569 }
2095 2570
2096 public void TriggerOarFileLoaded(Guid requestId, string message) 2571 public void TriggerOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message)
2097 { 2572 {
2098 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; 2573 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
2099 if (handlerOarFileLoaded != null) 2574 if (handlerOarFileLoaded != null)
@@ -2102,7 +2577,7 @@ namespace OpenSim.Region.Framework.Scenes
2102 { 2577 {
2103 try 2578 try
2104 { 2579 {
2105 d(requestId, message); 2580 d(requestId, loadedScenes, message);
2106 } 2581 }
2107 catch (Exception e) 2582 catch (Exception e)
2108 { 2583 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index dd9210f..35df85c 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
@@ -1997,6 +1997,9 @@ 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
2000 if (remoteClient == null) 2003 if (remoteClient == null)
2001 { 2004 {
2002 // Autoreturn has a null client. Nothing else does. So 2005 // 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 e970543..16c0d25 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -543,7 +543,7 @@ namespace OpenSim.Region.Framework.Scenes
543 if (!InventoryService.AddFolder(folder)) 543 if (!InventoryService.AddFolder(folder))
544 { 544 {
545 m_log.WarnFormat( 545 m_log.WarnFormat(
546 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", 546 "[AGENT INVENTORY]: Failed to create folder for user {0} {1}",
547 remoteClient.Name, remoteClient.AgentId); 547 remoteClient.Name, remoteClient.AgentId);
548 } 548 }
549 } 549 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8034bc6..29c8eb1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,8 +103,31 @@ namespace OpenSim.Region.Framework.Scenes
103 /// </summary> 103 /// </summary>
104 public bool CollidablePrims { get; private set; } 104 public bool CollidablePrims { get; private set; }
105 105
106 /// <summary>
107 /// Minimum value of the size of a non-physical prim in each axis
108 /// </summary>
109 public float m_minNonphys = 0.001f;
110
111 /// <summary>
112 /// Maximum value of the size of a non-physical prim in each axis
113 /// </summary>
106 public float m_maxNonphys = 256; 114 public float m_maxNonphys = 256;
115
116 /// <summary>
117 /// Minimum value of the size of a physical prim in each axis
118 /// </summary>
119 public float m_minPhys = 0.01f;
120
121 /// <summary>
122 /// Maximum value of the size of a physical prim in each axis
123 /// </summary>
107 public float m_maxPhys = 10; 124 public float m_maxPhys = 10;
125
126 /// <summary>
127 /// Max prims an object will hold
128 /// </summary>
129 public int m_linksetCapacity = 0;
130
108 public bool m_clampPrimSize; 131 public bool m_clampPrimSize;
109 public bool m_trustBinaries; 132 public bool m_trustBinaries;
110 public bool m_allowScriptCrossings; 133 public bool m_allowScriptCrossings;
@@ -746,12 +769,24 @@ namespace OpenSim.Region.Framework.Scenes
746 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 769 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
747 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 770 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
748 771
749 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 772 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
773 if (RegionInfo.NonphysPrimMin > 0)
774 {
775 m_minNonphys = RegionInfo.NonphysPrimMin;
776 }
777
778 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
750 if (RegionInfo.NonphysPrimMax > 0) 779 if (RegionInfo.NonphysPrimMax > 0)
751 { 780 {
752 m_maxNonphys = RegionInfo.NonphysPrimMax; 781 m_maxNonphys = RegionInfo.NonphysPrimMax;
753 } 782 }
754 783
784 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
785 if (RegionInfo.PhysPrimMin > 0)
786 {
787 m_minPhys = RegionInfo.PhysPrimMin;
788 }
789
755 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 790 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
756 791
757 if (RegionInfo.PhysPrimMax > 0) 792 if (RegionInfo.PhysPrimMax > 0)
@@ -759,6 +794,12 @@ namespace OpenSim.Region.Framework.Scenes
759 m_maxPhys = RegionInfo.PhysPrimMax; 794 m_maxPhys = RegionInfo.PhysPrimMax;
760 } 795 }
761 796
797 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
798 if (RegionInfo.LinksetCapacity > 0)
799 {
800 m_linksetCapacity = RegionInfo.LinksetCapacity;
801 }
802
762 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 803 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
763 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 804 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
764 805
@@ -854,6 +895,8 @@ namespace OpenSim.Region.Framework.Scenes
854 } 895 }
855 896
856 // FIXME: Ultimately this should be in a module. 897 // FIXME: Ultimately this should be in a module.
898 SendPeriodicAppearanceUpdates = true;
899
857 IConfig appearanceConfig = m_config.Configs["Appearance"]; 900 IConfig appearanceConfig = m_config.Configs["Appearance"];
858 if (appearanceConfig != null) 901 if (appearanceConfig != null)
859 { 902 {
@@ -3715,7 +3758,7 @@ namespace OpenSim.Region.Framework.Scenes
3715 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", 3758 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3716 sp.Name, sp.UUID, RegionInfo.RegionName); 3759 sp.Name, sp.UUID, RegionInfo.RegionName);
3717 3760
3718 sp.ControllingClient.Close(); 3761 sp.ControllingClient.Close(true, true);
3719 sp = null; 3762 sp = null;
3720 } 3763 }
3721 3764
@@ -4318,15 +4361,18 @@ namespace OpenSim.Region.Framework.Scenes
4318 /// Tell a single agent to disconnect from the region. 4361 /// Tell a single agent to disconnect from the region.
4319 /// </summary> 4362 /// </summary>
4320 /// <param name="agentID"></param> 4363 /// <param name="agentID"></param>
4321 /// <param name="childOnly"></param> 4364 /// <param name="force">
4322 public bool IncomingCloseAgent(UUID agentID, bool childOnly) 4365 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to
4366 /// force unless you are absolutely sure that the agent is dead and a normal close is not working.
4367 /// </param>
4368 public bool IncomingCloseAgent(UUID agentID, bool force)
4323 { 4369 {
4324 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4370 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
4325 4371
4326 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4372 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4327 if (presence != null) 4373 if (presence != null)
4328 { 4374 {
4329 presence.ControllingClient.Close(false); 4375 presence.ControllingClient.Close(force, force);
4330 return true; 4376 return true;
4331 } 4377 }
4332 4378
@@ -4532,6 +4578,16 @@ namespace OpenSim.Region.Framework.Scenes
4532 return LandChannel.GetLandObject(x, y).LandData; 4578 return LandChannel.GetLandObject(x, y).LandData;
4533 } 4579 }
4534 4580
4581 /// <summary>
4582 /// Get LandData by position.
4583 /// </summary>
4584 /// <param name="pos"></param>
4585 /// <returns></returns>
4586 public LandData GetLandData(Vector3 pos)
4587 {
4588 return GetLandData(pos.X, pos.Y);
4589 }
4590
4535 public LandData GetLandData(uint x, uint y) 4591 public LandData GetLandData(uint x, uint y)
4536 { 4592 {
4537 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); 4593 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y);
@@ -4780,6 +4836,18 @@ namespace OpenSim.Region.Framework.Scenes
4780 } 4836 }
4781 4837
4782 /// <summary> 4838 /// <summary>
4839 /// Attempt to get the SOG via its UUID
4840 /// </summary>
4841 /// <param name="fullID"></param>
4842 /// <param name="sog"></param>
4843 /// <returns></returns>
4844 public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog)
4845 {
4846 sog = GetSceneObjectGroup(fullID);
4847 return sog != null;
4848 }
4849
4850 /// <summary>
4783 /// Get a prim by name from the scene (will return the first 4851 /// Get a prim by name from the scene (will return the first
4784 /// found, if there are more than one prim with the same name) 4852 /// found, if there are more than one prim with the same name)
4785 /// </summary> 4853 /// </summary>
@@ -4811,6 +4879,18 @@ namespace OpenSim.Region.Framework.Scenes
4811 } 4879 }
4812 4880
4813 /// <summary> 4881 /// <summary>
4882 /// Attempt to get a prim via its UUID
4883 /// </summary>
4884 /// <param name="fullID"></param>
4885 /// <param name="sop"></param>
4886 /// <returns></returns>
4887 public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop)
4888 {
4889 sop = GetSceneObjectPart(fullID);
4890 return sop != null;
4891 }
4892
4893 /// <summary>
4814 /// Get a scene object group that contains the prim with the given local id 4894 /// Get a scene object group that contains the prim with the given local id
4815 /// </summary> 4895 /// </summary>
4816 /// <param name="localID"></param> 4896 /// <param name="localID"></param>
@@ -5865,6 +5945,9 @@ Environment.Exit(1);
5865 5945
5866 public string GetExtraSetting(string name) 5946 public string GetExtraSetting(string name)
5867 { 5947 {
5948 if (m_extraSettings == null)
5949 return String.Empty;
5950
5868 string val; 5951 string val;
5869 5952
5870 if (!m_extraSettings.TryGetValue(name, out val)) 5953 if (!m_extraSettings.TryGetValue(name, out val))
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e29b2c1..c4b7b27 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, true, false); 345 AddNewSceneObject(sceneObject, attachToBackup, false);
346 346
347 if (pos != null) 347 if (pos != null)
348 sceneObject.AbsolutePosition = (Vector3)pos; 348 sceneObject.AbsolutePosition = (Vector3)pos;
@@ -421,12 +421,9 @@ namespace OpenSim.Region.Framework.Scenes
421 { 421 {
422 Vector3 scale = part.Shape.Scale; 422 Vector3 scale = part.Shape.Scale;
423 423
424 if (scale.X > m_parentScene.m_maxNonphys) 424 scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X));
425 scale.X = m_parentScene.m_maxNonphys; 425 scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y));
426 if (scale.Y > m_parentScene.m_maxNonphys) 426 scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z));
427 scale.Y = m_parentScene.m_maxNonphys;
428 if (scale.Z > m_parentScene.m_maxNonphys)
429 scale.Z = m_parentScene.m_maxNonphys;
430 427
431 part.Shape.Scale = scale; 428 part.Shape.Scale = scale;
432 } 429 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index f1b09ca..dba3a61 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -92,7 +92,11 @@ 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 { return m_instance; } 95 get {
96 if (m_instance == null)
97 m_instance = new SceneManager();
98 return m_instance;
99 }
96 } 100 }
97 101
98 private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>(); 102 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 4798481..bf898bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2742,6 +2742,25 @@ namespace OpenSim.Region.Framework.Scenes
2742 if (objectGroup == this) 2742 if (objectGroup == this)
2743 return; 2743 return;
2744 2744
2745 // If the configured linkset capacity is greater than zero,
2746 // and the new linkset would have a prim count higher than this
2747 // value, do not link it.
2748 if (m_scene.m_linksetCapacity > 0 &&
2749 (PrimCount + objectGroup.PrimCount) >
2750 m_scene.m_linksetCapacity)
2751 {
2752 m_log.DebugFormat(
2753 "[SCENE OBJECT GROUP]: Cannot link group with root" +
2754 " part {0}, {1} ({2} prims) to group with root part" +
2755 " {3}, {4} ({5} prims) because the new linkset" +
2756 " would exceed the configured maximum of {6}",
2757 objectGroup.RootPart.Name, objectGroup.RootPart.UUID,
2758 objectGroup.PrimCount, RootPart.Name, RootPart.UUID,
2759 PrimCount, m_scene.m_linksetCapacity);
2760
2761 return;
2762 }
2763
2745 // 'linkPart' == the root of the group being linked into this group 2764 // 'linkPart' == the root of the group being linked into this group
2746 SceneObjectPart linkPart = objectGroup.m_rootPart; 2765 SceneObjectPart linkPart = objectGroup.m_rootPart;
2747 2766
@@ -3464,27 +3483,33 @@ namespace OpenSim.Region.Framework.Scenes
3464 /// <param name="scale"></param> 3483 /// <param name="scale"></param>
3465 public void GroupResize(Vector3 scale) 3484 public void GroupResize(Vector3 scale)
3466 { 3485 {
3467 scale.X = Math.Min(scale.X, Scene.m_maxNonphys); 3486// m_log.DebugFormat(
3468 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); 3487// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
3469 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
3470 3488
3471 PhysicsActor pa = m_rootPart.PhysActor; 3489 PhysicsActor pa = m_rootPart.PhysActor;
3472 3490
3473 if (pa != null && pa.IsPhysical) 3491 if (Scene != null)
3474 { 3492 {
3475 scale.X = Math.Min(scale.X, Scene.m_maxPhys); 3493 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
3476 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); 3494 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
3477 scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); 3495 scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
3496
3497 if (pa != null && pa.IsPhysical)
3498 {
3499 scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
3500 scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
3501 scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
3502 }
3478 } 3503 }
3479 3504
3480 float x = (scale.X / RootPart.Scale.X); 3505 float x = (scale.X / RootPart.Scale.X);
3481 float y = (scale.Y / RootPart.Scale.Y); 3506 float y = (scale.Y / RootPart.Scale.Y);
3482 float z = (scale.Z / RootPart.Scale.Z); 3507 float z = (scale.Z / RootPart.Scale.Z);
3483 3508
3484 SceneObjectPart[] parts; 3509 SceneObjectPart[] parts = m_parts.GetArray();
3485 if (x > 1.0f || y > 1.0f || z > 1.0f) 3510
3511 if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f))
3486 { 3512 {
3487 parts = m_parts.GetArray();
3488 for (int i = 0; i < parts.Length; i++) 3513 for (int i = 0; i < parts.Length; i++)
3489 { 3514 {
3490 SceneObjectPart obPart = parts[i]; 3515 SceneObjectPart obPart = parts[i];
@@ -3497,7 +3522,7 @@ namespace OpenSim.Region.Framework.Scenes
3497 3522
3498 if (pa != null && pa.IsPhysical) 3523 if (pa != null && pa.IsPhysical)
3499 { 3524 {
3500 if (oldSize.X * x > m_scene.m_maxPhys) 3525 if (oldSize.X * x > Scene.m_maxPhys)
3501 { 3526 {
3502 f = m_scene.m_maxPhys / oldSize.X; 3527 f = m_scene.m_maxPhys / oldSize.X;
3503 a = f / x; 3528 a = f / x;
@@ -3505,8 +3530,16 @@ namespace OpenSim.Region.Framework.Scenes
3505 y *= a; 3530 y *= a;
3506 z *= a; 3531 z *= a;
3507 } 3532 }
3533 else if (oldSize.X * x < Scene.m_minPhys)
3534 {
3535 f = m_scene.m_minPhys / oldSize.X;
3536 a = f / x;
3537 x *= a;
3538 y *= a;
3539 z *= a;
3540 }
3508 3541
3509 if (oldSize.Y * y > m_scene.m_maxPhys) 3542 if (oldSize.Y * y > Scene.m_maxPhys)
3510 { 3543 {
3511 f = m_scene.m_maxPhys / oldSize.Y; 3544 f = m_scene.m_maxPhys / oldSize.Y;
3512 a = f / y; 3545 a = f / y;
@@ -3514,8 +3547,16 @@ namespace OpenSim.Region.Framework.Scenes
3514 y *= a; 3547 y *= a;
3515 z *= a; 3548 z *= a;
3516 } 3549 }
3550 else if (oldSize.Y * y < Scene.m_minPhys)
3551 {
3552 f = m_scene.m_minPhys / oldSize.Y;
3553 a = f / y;
3554 x *= a;
3555 y *= a;
3556 z *= a;
3557 }
3517 3558
3518 if (oldSize.Z * z > m_scene.m_maxPhys) 3559 if (oldSize.Z * z > Scene.m_maxPhys)
3519 { 3560 {
3520 f = m_scene.m_maxPhys / oldSize.Z; 3561 f = m_scene.m_maxPhys / oldSize.Z;
3521 a = f / z; 3562 a = f / z;
@@ -3523,10 +3564,18 @@ namespace OpenSim.Region.Framework.Scenes
3523 y *= a; 3564 y *= a;
3524 z *= a; 3565 z *= a;
3525 } 3566 }
3567 else if (oldSize.Z * z < Scene.m_minPhys)
3568 {
3569 f = m_scene.m_minPhys / oldSize.Z;
3570 a = f / z;
3571 x *= a;
3572 y *= a;
3573 z *= a;
3574 }
3526 } 3575 }
3527 else 3576 else
3528 { 3577 {
3529 if (oldSize.X * x > m_scene.m_maxNonphys) 3578 if (oldSize.X * x > Scene.m_maxNonphys)
3530 { 3579 {
3531 f = m_scene.m_maxNonphys / oldSize.X; 3580 f = m_scene.m_maxNonphys / oldSize.X;
3532 a = f / x; 3581 a = f / x;
@@ -3534,8 +3583,16 @@ namespace OpenSim.Region.Framework.Scenes
3534 y *= a; 3583 y *= a;
3535 z *= a; 3584 z *= a;
3536 } 3585 }
3586 else if (oldSize.X * x < Scene.m_minNonphys)
3587 {
3588 f = m_scene.m_minNonphys / oldSize.X;
3589 a = f / x;
3590 x *= a;
3591 y *= a;
3592 z *= a;
3593 }
3537 3594
3538 if (oldSize.Y * y > m_scene.m_maxNonphys) 3595 if (oldSize.Y * y > Scene.m_maxNonphys)
3539 { 3596 {
3540 f = m_scene.m_maxNonphys / oldSize.Y; 3597 f = m_scene.m_maxNonphys / oldSize.Y;
3541 a = f / y; 3598 a = f / y;
@@ -3543,8 +3600,16 @@ namespace OpenSim.Region.Framework.Scenes
3543 y *= a; 3600 y *= a;
3544 z *= a; 3601 z *= a;
3545 } 3602 }
3603 else if (oldSize.Y * y < Scene.m_minNonphys)
3604 {
3605 f = m_scene.m_minNonphys / oldSize.Y;
3606 a = f / y;
3607 x *= a;
3608 y *= a;
3609 z *= a;
3610 }
3546 3611
3547 if (oldSize.Z * z > m_scene.m_maxNonphys) 3612 if (oldSize.Z * z > Scene.m_maxNonphys)
3548 { 3613 {
3549 f = m_scene.m_maxNonphys / oldSize.Z; 3614 f = m_scene.m_maxNonphys / oldSize.Z;
3550 a = f / z; 3615 a = f / z;
@@ -3552,6 +3617,14 @@ namespace OpenSim.Region.Framework.Scenes
3552 y *= a; 3617 y *= a;
3553 z *= a; 3618 z *= a;
3554 } 3619 }
3620 else if (oldSize.Z * z < Scene.m_minNonphys)
3621 {
3622 f = m_scene.m_minNonphys / oldSize.Z;
3623 a = f / z;
3624 x *= a;
3625 y *= a;
3626 z *= a;
3627 }
3555 } 3628 }
3556 } 3629 }
3557 } 3630 }
@@ -3564,7 +3637,6 @@ namespace OpenSim.Region.Framework.Scenes
3564 3637
3565 RootPart.Resize(prevScale); 3638 RootPart.Resize(prevScale);
3566 3639
3567 parts = m_parts.GetArray();
3568 for (int i = 0; i < parts.Length; i++) 3640 for (int i = 0; i < parts.Length; i++)
3569 { 3641 {
3570 SceneObjectPart obPart = parts[i]; 3642 SceneObjectPart obPart = parts[i];
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e6ad89c..a31a9ea 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.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 793 m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
794 } 794 }
795 } 795 }
796 } 796 }
@@ -2972,17 +2972,20 @@ namespace OpenSim.Region.Framework.Scenes
2972 /// <param name="scale"></param> 2972 /// <param name="scale"></param>
2973 public void Resize(Vector3 scale) 2973 public void Resize(Vector3 scale)
2974 { 2974 {
2975 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys);
2976 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
2977 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
2978
2979 PhysicsActor pa = PhysActor; 2975 PhysicsActor pa = PhysActor;
2980 2976
2981 if (pa != null && pa.IsPhysical) 2977 if (ParentGroup.Scene != null)
2982 { 2978 {
2983 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); 2979 scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
2984 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); 2980 scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
2985 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); 2981 scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
2982
2983 if (pa != null && pa.IsPhysical)
2984 {
2985 scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
2986 scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
2987 scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
2988 }
2986 } 2989 }
2987 2990
2988// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2991// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
@@ -3567,23 +3570,32 @@ namespace OpenSim.Region.Framework.Scenes
3567 } 3570 }
3568 3571
3569 /// <summary> 3572 /// <summary>
3570 /// Set the color of prim faces 3573 /// Set the color & alpha of prim faces
3571 /// </summary> 3574 /// </summary>
3572 /// <param name="color"></param>
3573 /// <param name="face"></param> 3575 /// <param name="face"></param>
3574 public void SetFaceColor(Vector3 color, int face) 3576 /// <param name="color"></param>
3577 /// <param name="alpha"></param>
3578 public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha)
3575 { 3579 {
3580 Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
3581 float clippedAlpha = alpha.HasValue ?
3582 Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0;
3583
3576 // 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
3577 // mever detect color changes further down. 3585 // never detect color changes further down.
3578 Byte[] buf = Shape.Textures.GetBytes(); 3586 Byte[] buf = Shape.Textures.GetBytes();
3579 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); 3587 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
3580 Color4 texcolor; 3588 Color4 texcolor;
3581 if (face >= 0 && face < GetNumberOfSides()) 3589 if (face >= 0 && face < GetNumberOfSides())
3582 { 3590 {
3583 texcolor = tex.CreateFace((uint)face).RGBA; 3591 texcolor = tex.CreateFace((uint)face).RGBA;
3584 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3592 texcolor.R = clippedColor.X;
3585 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3593 texcolor.G = clippedColor.Y;
3586 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3594 texcolor.B = clippedColor.Z;
3595 if (alpha.HasValue)
3596 {
3597 texcolor.A = clippedAlpha;
3598 }
3587 tex.FaceTextures[face].RGBA = texcolor; 3599 tex.FaceTextures[face].RGBA = texcolor;
3588 UpdateTextureEntry(tex.GetBytes()); 3600 UpdateTextureEntry(tex.GetBytes());
3589 return; 3601 return;
@@ -3595,15 +3607,23 @@ namespace OpenSim.Region.Framework.Scenes
3595 if (tex.FaceTextures[i] != null) 3607 if (tex.FaceTextures[i] != null)
3596 { 3608 {
3597 texcolor = tex.FaceTextures[i].RGBA; 3609 texcolor = tex.FaceTextures[i].RGBA;
3598 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3610 texcolor.R = clippedColor.X;
3599 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3611 texcolor.G = clippedColor.Y;
3600 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3612 texcolor.B = clippedColor.Z;
3613 if (alpha.HasValue)
3614 {
3615 texcolor.A = clippedAlpha;
3616 }
3601 tex.FaceTextures[i].RGBA = texcolor; 3617 tex.FaceTextures[i].RGBA = texcolor;
3602 } 3618 }
3603 texcolor = tex.DefaultTexture.RGBA; 3619 texcolor = tex.DefaultTexture.RGBA;
3604 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3620 texcolor.R = clippedColor.X;
3605 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3621 texcolor.G = clippedColor.Y;
3606 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3622 texcolor.B = clippedColor.Z;
3623 if (alpha.HasValue)
3624 {
3625 texcolor.A = clippedAlpha;
3626 }
3607 tex.DefaultTexture.RGBA = texcolor; 3627 tex.DefaultTexture.RGBA = texcolor;
3608 } 3628 }
3609 UpdateTextureEntry(tex.GetBytes()); 3629 UpdateTextureEntry(tex.GetBytes());
@@ -4891,6 +4911,57 @@ namespace OpenSim.Region.Framework.Scenes
4891 ScheduleFullUpdate(); 4911 ScheduleFullUpdate();
4892 } 4912 }
4893 4913
4914 public void UpdateSlice(float begin, float end)
4915 {
4916 if (end < begin)
4917 {
4918 float temp = begin;
4919 begin = end;
4920 end = temp;
4921 }
4922 end = Math.Min(1f, Math.Max(0f, end));
4923 begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
4924 if (begin < 0.02f && end < 0.02f)
4925 {
4926 begin = 0f;
4927 end = 0.02f;
4928 }
4929
4930 ushort uBegin = (ushort)(50000.0 * begin);
4931 ushort uEnd = (ushort)(50000.0 * (1f - end));
4932 bool updatePossiblyNeeded = false;
4933 PrimType primType = GetPrimType();
4934 if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING)
4935 {
4936 if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
4937 {
4938 m_shape.ProfileBegin = uBegin;
4939 m_shape.ProfileEnd = uEnd;
4940 updatePossiblyNeeded = true;
4941 }
4942 }
4943 else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
4944 {
4945 m_shape.PathBegin = uBegin;
4946 m_shape.PathEnd = uEnd;
4947 updatePossiblyNeeded = true;
4948 }
4949
4950 if (updatePossiblyNeeded && ParentGroup != null)
4951 {
4952 ParentGroup.HasGroupChanged = true;
4953 }
4954 if (updatePossiblyNeeded && PhysActor != null)
4955 {
4956 PhysActor.Shape = m_shape;
4957 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
4958 }
4959 if (updatePossiblyNeeded)
4960 {
4961 ScheduleFullUpdate();
4962 }
4963 }
4964
4894 /// <summary> 4965 /// <summary>
4895 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics 4966 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
4896 /// engine can use it. 4967 /// engine can use it.
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a8aa551..adb3d38 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -974,7 +974,9 @@ namespace OpenSim.Region.Framework.Scenes
974 { 974 {
975 if (wasChild && HasAttachments()) 975 if (wasChild && HasAttachments())
976 { 976 {
977 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 977 m_log.DebugFormat(
978 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
979
978 // Resume scripts 980 // Resume scripts
979 Util.FireAndForget(delegate(object x) { 981 Util.FireAndForget(delegate(object x) {
980 foreach (SceneObjectGroup sog in m_attachments) 982 foreach (SceneObjectGroup sog in m_attachments)
@@ -1530,17 +1532,22 @@ namespace OpenSim.Region.Framework.Scenes
1530 bool DCFlagKeyPressed = false; 1532 bool DCFlagKeyPressed = false;
1531 Vector3 agent_control_v3 = Vector3.Zero; 1533 Vector3 agent_control_v3 = Vector3.Zero;
1532 1534
1533 bool oldflying = Flying; 1535 bool newFlying = actor.Flying;
1534 1536
1535 if (ForceFly) 1537 if (ForceFly)
1536 actor.Flying = true; 1538 newFlying = true;
1537 else if (FlyDisabled) 1539 else if (FlyDisabled)
1538 actor.Flying = false; 1540 newFlying = false;
1539 else 1541 else
1540 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1542 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1541 1543
1542 if (actor.Flying != oldflying) 1544 if (actor.Flying != newFlying)
1545 {
1546 // Note: ScenePresence.Flying is actually fetched from the physical actor
1547 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1548 actor.Flying = newFlying;
1543 update_movementflag = true; 1549 update_movementflag = true;
1550 }
1544 1551
1545 if (ParentID == 0) 1552 if (ParentID == 0)
1546 { 1553 {
@@ -3627,13 +3634,16 @@ namespace OpenSim.Region.Framework.Scenes
3627 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) 3634 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
3628 { 3635 {
3629 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); 3636 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3630 3637
3631 lock (m_attachments) 3638 if (attachmentPoint >= 0)
3632 { 3639 {
3633 foreach (SceneObjectGroup so in m_attachments) 3640 lock (m_attachments)
3634 { 3641 {
3635 if (attachmentPoint == so.AttachmentPoint) 3642 foreach (SceneObjectGroup so in m_attachments)
3636 attachments.Add(so); 3643 {
3644 if (attachmentPoint == so.AttachmentPoint)
3645 attachments.Add(so);
3646 }
3637 } 3647 }
3638 } 3648 }
3639 3649
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5758869..5faf131 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); 144 scene.IncomingCloseAgent(sp.UUID, false);
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/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index 44d2d45..9457ebb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -50,9 +50,41 @@ using OpenSim.Tests.Common.Mock;
50namespace OpenSim.Region.Framework.Tests 50namespace OpenSim.Region.Framework.Tests
51{ 51{
52 [TestFixture] 52 [TestFixture]
53 public class UserInventoryTests 53 public class UserInventoryTests : OpenSimTestCase
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]
56 public void TestGiveInventoryItem() 88 public void TestGiveInventoryItem()
57 { 89 {
58 TestHelpers.InMethod(); 90 TestHelpers.InMethod();
@@ -83,7 +115,7 @@ namespace OpenSim.Region.Framework.Tests
83 public void TestGiveInventoryFolder() 115 public void TestGiveInventoryFolder()
84 { 116 {
85 TestHelpers.InMethod(); 117 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 118// TestHelpers.EnableLogging();
87 119
88 Scene scene = new SceneHelpers().SetupScene(); 120 Scene scene = new SceneHelpers().SetupScene();
89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); 121 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 411e421..b5ef7b0 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -52,26 +52,23 @@ 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;
66 55
67 /// <summary> 56 protected IAssetService m_assetService;
68 /// Signal whether we are currently waiting for the asset service to deliver an asset. 57
69 /// </summary> 58// /// <summary>
70 private bool m_waitingForObjectAsset; 59// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
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;
71 68
72 public UuidGatherer(IAssetService assetCache) 69 public UuidGatherer(IAssetService assetCache)
73 { 70 {
74 m_assetCache = assetCache; 71 m_assetService = assetCache;
75 } 72 }
76 73
77 /// <summary> 74 /// <summary>
@@ -191,18 +188,18 @@ namespace OpenSim.Region.Framework.Scenes
191 } 188 }
192 } 189 }
193 190
194 /// <summary> 191// /// <summary>
195 /// The callback made when we request the asset for an object from the asset service. 192// /// The callback made when we request the asset for an object from the asset service.
196 /// </summary> 193// /// </summary>
197 private void AssetReceived(string id, Object sender, AssetBase asset) 194// private void AssetReceived(string id, Object sender, AssetBase asset)
198 { 195// {
199 lock (this) 196// lock (this)
200 { 197// {
201 m_requestedObjectAsset = asset; 198// m_requestedObjectAsset = asset;
202 m_waitingForObjectAsset = false; 199// m_waitingForObjectAsset = false;
203 Monitor.Pulse(this); 200// Monitor.Pulse(this);
204 } 201// }
205 } 202// }
206 203
207 /// <summary> 204 /// <summary>
208 /// Get an asset synchronously, potentially using an asynchronous callback. If the 205 /// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -212,25 +209,29 @@ namespace OpenSim.Region.Framework.Scenes
212 /// <returns></returns> 209 /// <returns></returns>
213 protected virtual AssetBase GetAsset(UUID uuid) 210 protected virtual AssetBase GetAsset(UUID uuid)
214 { 211 {
215 m_waitingForObjectAsset = true; 212 return m_assetService.Get(uuid.ToString());
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 }
232 213
233 return m_requestedObjectAsset; 214 // XXX: Switching to do this synchronously where the call was async before but we always waited for it
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;
234 } 235 }
235 236
236 /// <summary> 237 /// <summary>
@@ -361,4 +362,47 @@ namespace OpenSim.Region.Framework.Scenes
361 } 362 }
362 } 363 }
363 } 364 }
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 }
364} 408}