aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs138
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs214
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs192
4 files changed, 364 insertions, 191 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index b557ffe..0271738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -57,39 +57,36 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Return a xfer uploader if one does not already exist. 60 /// Return the xfer uploader for the given transaction.
61 /// </summary> 61 /// </summary>
62 /// <remarks>
63 /// If an uploader does not already exist for this transaction then it is created, otherwise the existing
64 /// uploader is returned.
65 /// </remarks>
62 /// <param name="transactionID"></param> 66 /// <param name="transactionID"></param>
63 /// <param name="assetID"> 67 /// <returns>The asset xfer uploader</returns>
64 /// We must transfer the new asset ID into the uploader on creation, otherwise 68 public AssetXferUploader RequestXferUploader(UUID transactionID)
65 /// we can see race conditions with other threads which can retrieve an item before it is updated with the new
66 /// asset id.
67 /// </param>
68 /// <returns>
69 /// The xfer uploader requested. Null if one is already in existence.
70 /// FIXME: This is a bizarre thing to do, and is probably meant to signal an error condition if multiple
71 /// transfers are made. Needs to be corrected.
72 /// </returns>
73 public AssetXferUploader RequestXferUploader(UUID transactionID, UUID assetID)
74 { 69 {
70 AssetXferUploader uploader;
71
75 lock (XferUploaders) 72 lock (XferUploaders)
76 { 73 {
77 if (!XferUploaders.ContainsKey(transactionID)) 74 if (!XferUploaders.ContainsKey(transactionID))
78 { 75 {
79 AssetXferUploader uploader = new AssetXferUploader(this, m_Scene, assetID, m_dumpAssetsToFile); 76 uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
80 77
81// m_log.DebugFormat( 78// m_log.DebugFormat(
82// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID); 79// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
83 80
84 XferUploaders.Add(transactionID, uploader); 81 XferUploaders.Add(transactionID, uploader);
85 82 }
86 return uploader; 83 else
84 {
85 uploader = XferUploaders[transactionID];
87 } 86 }
88 } 87 }
89 88
90 m_log.WarnFormat("[AGENT ASSETS TRANSACTIONS]: Ignoring request for asset xfer uploader {0} since it already exists", transactionID); 89 return uploader;
91
92 return null;
93 } 90 }
94 91
95 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 92 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
@@ -151,115 +148,28 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
151 string description, string name, sbyte invType, 148 string description, string name, sbyte invType,
152 sbyte type, byte wearableType, uint nextOwnerMask) 149 sbyte type, byte wearableType, uint nextOwnerMask)
153 { 150 {
154 AssetXferUploader uploader = null; 151 AssetXferUploader uploader = RequestXferUploader(transactionID);
155
156 lock (XferUploaders)
157 {
158 if (XferUploaders.ContainsKey(transactionID))
159 uploader = XferUploaders[transactionID];
160 }
161 152
162 if (uploader != null) 153 uploader.RequestCreateInventoryItem(
163 uploader.RequestCreateInventoryItem( 154 remoteClient, folderID, callbackID,
164 remoteClient, transactionID, folderID, 155 description, name, invType, type, wearableType, nextOwnerMask);
165 callbackID, description, name, invType, type,
166 wearableType, nextOwnerMask);
167 else
168 m_log.ErrorFormat(
169 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to create inventory item {1} from {2}",
170 transactionID, name, remoteClient.Name);
171 }
172
173 /// <summary>
174 /// Get an uploaded asset. If the data is successfully retrieved,
175 /// the transaction will be removed.
176 /// </summary>
177 /// <param name="transactionID"></param>
178 /// <returns>The asset if the upload has completed, null if it has not.</returns>
179 private AssetBase GetTransactionAsset(UUID transactionID)
180 {
181 lock (XferUploaders)
182 {
183 if (XferUploaders.ContainsKey(transactionID))
184 {
185 AssetXferUploader uploader = XferUploaders[transactionID];
186 AssetBase asset = uploader.GetAssetData();
187 RemoveXferUploader(transactionID);
188
189 return asset;
190 }
191 }
192
193 return null;
194 } 156 }
195 157
196 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, 158 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
197 SceneObjectPart part, UUID transactionID, 159 SceneObjectPart part, UUID transactionID,
198 TaskInventoryItem item) 160 TaskInventoryItem item)
199 { 161 {
200 AssetXferUploader uploader = null; 162 AssetXferUploader uploader = RequestXferUploader(transactionID);
201
202 lock (XferUploaders)
203 {
204 if (XferUploaders.ContainsKey(transactionID))
205 uploader = XferUploaders[transactionID];
206 }
207
208 if (uploader != null)
209 {
210 AssetBase asset = GetTransactionAsset(transactionID);
211
212 // Only legacy viewers use this, and they prefer CAPS, which
213 // we have, so this really never runs.
214 // Allow it, but only for "safe" types.
215 if ((InventoryType)item.InvType != InventoryType.Notecard &&
216 (InventoryType)item.InvType != InventoryType.LSL)
217 return;
218 163
219 if (asset != null) 164 uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
220 {
221// m_log.DebugFormat(
222// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
223// item.Name, part.Name, transactionID);
224
225 asset.FullID = UUID.Random();
226 asset.Name = item.Name;
227 asset.Description = item.Description;
228 asset.Type = (sbyte)item.Type;
229 item.AssetID = asset.FullID;
230
231 m_Scene.AssetService.Store(asset);
232 }
233 }
234 else
235 {
236 m_log.ErrorFormat(
237 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update task inventory item {1} in {2}",
238 transactionID, item.Name, part.Name);
239 }
240 } 165 }
241 166
242 public void RequestUpdateInventoryItem(IClientAPI remoteClient, 167 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
243 UUID transactionID, InventoryItemBase item) 168 UUID transactionID, InventoryItemBase item)
244 { 169 {
245 AssetXferUploader uploader = null; 170 AssetXferUploader uploader = RequestXferUploader(transactionID);
246
247 lock (XferUploaders)
248 {
249 if (XferUploaders.ContainsKey(transactionID))
250 uploader = XferUploaders[transactionID];
251 }
252 171
253 if (uploader != null) 172 uploader.RequestUpdateInventoryItem(remoteClient, item);
254 {
255 uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item);
256 }
257 else
258 {
259 m_log.ErrorFormat(
260 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update inventory item {1} for {2}",
261 transactionID, item.Name, remoteClient.Name);
262 }
263 } 173 }
264 } 174 }
265} 175} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7081989..73d1f72 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) 215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
216 { 216 {
217 m_log.DebugFormat( 217 m_log.DebugFormat(
218 "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}", 218 "[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName); 219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
220 220
221 AgentAssetTransactions transactions = 221 AgentAssetTransactions transactions =
@@ -274,13 +274,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
274 } 274 }
275 275
276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction, assetID); 277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
278 278 uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
279 if (uploader != null)
280 {
281 uploader.Initialise(remoteClient, assetID, transaction, type,
282 data, storeLocal, tempFile);
283 }
284 } 279 }
285 280
286 /// <summary> 281 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index ec4dfd0..8d21202 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -41,38 +41,72 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 /// <summary> 43 /// <summary>
44 /// Upload state.
45 /// </summary>
46 /// <remarks>
47 /// New -> Uploading -> Complete
48 /// </remarks>
49 private enum UploadState
50 {
51 New,
52 Uploading,
53 Complete
54 }
55
56 /// <summary>
44 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we 57 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we
45 /// are performing a delayed update. 58 /// are performing a delayed update.
46 /// </summary> 59 /// </summary>
47 AgentAssetTransactions m_transactions; 60 AgentAssetTransactions m_transactions;
48 61
62 private UploadState m_uploadState = UploadState.New;
63
49 private AssetBase m_asset; 64 private AssetBase m_asset;
50 private UUID InventFolder = UUID.Zero; 65 private UUID InventFolder = UUID.Zero;
51 private sbyte invType = 0; 66 private sbyte invType = 0;
52 67
53 private bool m_createItem = false; 68 private bool m_createItem;
54 private uint m_createItemCallback = 0; 69 private uint m_createItemCallback;
55 private bool m_updateItem = false; 70
71 private bool m_updateItem;
56 private InventoryItemBase m_updateItemData; 72 private InventoryItemBase m_updateItemData;
57 73
74 private bool m_updateTaskItem;
75 private TaskInventoryItem m_updateTaskItemData;
76
58 private string m_description = String.Empty; 77 private string m_description = String.Empty;
59 private bool m_dumpAssetToFile; 78 private bool m_dumpAssetToFile;
60 private bool m_finished = false;
61 private string m_name = String.Empty; 79 private string m_name = String.Empty;
62 private bool m_storeLocal; 80// private bool m_storeLocal;
63 private uint nextPerm = 0; 81 private uint nextPerm = 0;
64 private IClientAPI ourClient; 82 private IClientAPI ourClient;
65 private UUID TransactionID = UUID.Zero; 83
84 private UUID m_transactionID;
85
66 private sbyte type = 0; 86 private sbyte type = 0;
67 private byte wearableType = 0; 87 private byte wearableType = 0;
68 public ulong XferID; 88 public ulong XferID;
69 private Scene m_Scene; 89 private Scene m_Scene;
70 90
71 public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, UUID assetID, bool dumpAssetToFile) 91 /// <summary>
92 /// AssetXferUploader constructor
93 /// </summary>
94 /// <param name='transactions'>/param>
95 /// <param name='scene'></param>
96 /// <param name='transactionID'></param>
97 /// <param name='dumpAssetToFile'>
98 /// If true then when the asset is uploaded it is dumped to a file with the format
99 /// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
100 /// now.Year, now.Month, now.Day, now.Hour, now.Minute,
101 /// now.Second, m_asset.Name, m_asset.Type);
102 /// for debugging purposes.
103 /// </param>
104 public AssetXferUploader(
105 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
72 { 106 {
73 m_transactions = transactions; 107 m_transactions = transactions;
108 m_transactionID = transactionID;
74 m_Scene = scene; 109 m_Scene = scene;
75 m_asset = new AssetBase() { FullID = assetID };
76 m_dumpAssetToFile = dumpAssetToFile; 110 m_dumpAssetToFile = dumpAssetToFile;
77 } 111 }
78 112
@@ -118,20 +152,43 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
118 } 152 }
119 153
120 /// <summary> 154 /// <summary>
121 /// Initialise asset transfer from the client 155 /// Start asset transfer from the client
122 /// </summary> 156 /// </summary>
123 /// <param name="xferID"></param> 157 /// <param name="remoteClient"></param>
124 /// <param name="packetID"></param> 158 /// <param name="assetID"></param>
125 /// <param name="data"></param> 159 /// <param name="transaction"></param>
126 public void Initialise(IClientAPI remoteClient, UUID assetID, 160 /// <param name="type"></param>
127 UUID transaction, sbyte type, byte[] data, bool storeLocal, 161 /// <param name="data">
128 bool tempFile) 162 /// Optional data. If present then the asset is created immediately with this data
163 /// rather than requesting an upload from the client. The data must be longer than 2 bytes.
164 /// </param>
165 /// <param name="storeLocal"></param>
166 /// <param name="tempFile"></param>
167 public void StartUpload(
168 IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal,
169 bool tempFile)
129 { 170 {
130// m_log.DebugFormat( 171// m_log.DebugFormat(
131// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}", 172// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}",
132// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length); 173// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length);
133 174
175 lock (this)
176 {
177 if (m_uploadState != UploadState.New)
178 {
179 m_log.WarnFormat(
180 "[ASSET XFER UPLOADER]: Tried to start upload of asset {0}, transaction {1} for {2} but this is already in state {3}. Aborting.",
181 assetID, transaction, remoteClient.Name, m_uploadState);
182
183 return;
184 }
185
186 m_uploadState = UploadState.Uploading;
187 }
188
134 ourClient = remoteClient; 189 ourClient = remoteClient;
190
191 m_asset = new AssetBase() { FullID = assetID };
135 m_asset.Name = "blank"; 192 m_asset.Name = "blank";
136 m_asset.Description = "empty"; 193 m_asset.Description = "empty";
137 m_asset.Type = type; 194 m_asset.Type = type;
@@ -140,8 +197,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
140 m_asset.Local = storeLocal; 197 m_asset.Local = storeLocal;
141 m_asset.Temporary = tempFile; 198 m_asset.Temporary = tempFile;
142 199
143 TransactionID = transaction; 200// m_storeLocal = storeLocal;
144 m_storeLocal = storeLocal;
145 201
146 if (m_asset.Data.Length > 2) 202 if (m_asset.Data.Length > 2)
147 { 203 {
@@ -166,14 +222,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
166 222
167 protected void SendCompleteMessage() 223 protected void SendCompleteMessage()
168 { 224 {
169 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
170 m_asset.FullID);
171
172 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create 225 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create
173 // message from other client UDP. 226 // message from other client UDP.
174 lock (this) 227 lock (this)
175 { 228 {
176 m_finished = true; 229 m_uploadState = UploadState.Complete;
230
231 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
232
177 if (m_createItem) 233 if (m_createItem)
178 { 234 {
179 DoCreateItem(m_createItemCallback); 235 DoCreateItem(m_createItemCallback);
@@ -185,17 +241,23 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
185 // Remove ourselves from the list of transactions if completion was delayed until the transaction 241 // Remove ourselves from the list of transactions if completion was delayed until the transaction
186 // was complete. 242 // was complete.
187 // TODO: Should probably do the same for create item. 243 // TODO: Should probably do the same for create item.
188 m_transactions.RemoveXferUploader(TransactionID); 244 m_transactions.RemoveXferUploader(m_transactionID);
189 } 245 }
190 else if (m_storeLocal) 246 else if (m_updateTaskItem)
191 { 247 {
192 m_Scene.AssetService.Store(m_asset); 248 StoreAssetForTaskItemUpdate(m_updateTaskItemData);
249
250 m_transactions.RemoveXferUploader(m_transactionID);
193 } 251 }
252// else if (m_storeLocal)
253// {
254// m_Scene.AssetService.Store(m_asset);
255// }
194 } 256 }
195 257
196 m_log.DebugFormat( 258 m_log.DebugFormat(
197 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", 259 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
198 m_asset.FullID, TransactionID); 260 m_asset.FullID, m_transactionID);
199 261
200 if (m_dumpAssetToFile) 262 if (m_dumpAssetToFile)
201 { 263 {
@@ -223,40 +285,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
223 } 285 }
224 286
225 public void RequestCreateInventoryItem(IClientAPI remoteClient, 287 public void RequestCreateInventoryItem(IClientAPI remoteClient,
226 UUID transactionID, UUID folderID, uint callbackID, 288 UUID folderID, uint callbackID,
227 string description, string name, sbyte invType, 289 string description, string name, sbyte invType,
228 sbyte type, byte wearableType, uint nextOwnerMask) 290 sbyte type, byte wearableType, uint nextOwnerMask)
229 { 291 {
230 if (TransactionID == transactionID) 292 InventFolder = folderID;
293 m_name = name;
294 m_description = description;
295 this.type = type;
296 this.invType = invType;
297 this.wearableType = wearableType;
298 nextPerm = nextOwnerMask;
299 m_asset.Name = name;
300 m_asset.Description = description;
301 m_asset.Type = type;
302
303 // We must lock to avoid a race with a separate thread uploading the asset.
304 lock (this)
231 { 305 {
232 InventFolder = folderID; 306 if (m_uploadState == UploadState.Complete)
233 m_name = name;
234 m_description = description;
235 this.type = type;
236 this.invType = invType;
237 this.wearableType = wearableType;
238 nextPerm = nextOwnerMask;
239 m_asset.Name = name;
240 m_asset.Description = description;
241 m_asset.Type = type;
242
243 // We must lock to avoid a race with a separate thread uploading the asset.
244 lock (this)
245 { 307 {
246 if (m_finished) 308 DoCreateItem(callbackID);
247 { 309 }
248 DoCreateItem(callbackID); 310 else
249 } 311 {
250 else 312 m_createItem = true; //set flag so the inventory item is created when upload is complete
251 { 313 m_createItemCallback = callbackID;
252 m_createItem = true; //set flag so the inventory item is created when upload is complete
253 m_createItemCallback = callbackID;
254 }
255 } 314 }
256 } 315 }
257 } 316 }
258 317
259 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 318 public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
260 { 319 {
261 // We must lock to avoid a race with a separate thread uploading the asset. 320 // We must lock to avoid a race with a separate thread uploading the asset.
262 lock (this) 321 lock (this)
@@ -271,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
271 item.AssetID = m_asset.FullID; 330 item.AssetID = m_asset.FullID;
272 m_Scene.InventoryService.UpdateItem(item); 331 m_Scene.InventoryService.UpdateItem(item);
273 332
274 if (m_finished) 333 if (m_uploadState == UploadState.Complete)
275 { 334 {
276 StoreAssetForItemUpdate(item); 335 StoreAssetForItemUpdate(item);
277 } 336 }
@@ -287,8 +346,30 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
287 } 346 }
288 } 347 }
289 348
349 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
350 {
351 // We must lock to avoid a race with a separate thread uploading the asset.
352 lock (this)
353 {
354 m_asset.Name = taskItem.Name;
355 m_asset.Description = taskItem.Description;
356 m_asset.Type = (sbyte)taskItem.Type;
357 taskItem.AssetID = m_asset.FullID;
358
359 if (m_uploadState == UploadState.Complete)
360 {
361 StoreAssetForTaskItemUpdate(taskItem);
362 }
363 else
364 {
365 m_updateTaskItem = true;
366 m_updateTaskItemData = taskItem;
367 }
368 }
369 }
370
290 /// <summary> 371 /// <summary>
291 /// Store the asset for the given item. 372 /// Store the asset for the given item when it has been uploaded.
292 /// </summary> 373 /// </summary>
293 /// <param name="item"></param> 374 /// <param name="item"></param>
294 private void StoreAssetForItemUpdate(InventoryItemBase item) 375 private void StoreAssetForItemUpdate(InventoryItemBase item)
@@ -300,6 +381,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
300 m_Scene.AssetService.Store(m_asset); 381 m_Scene.AssetService.Store(m_asset);
301 } 382 }
302 383
384 /// <summary>
385 /// Store the asset for the given task item when it has been uploaded.
386 /// </summary>
387 /// <param name="taskItem"></param>
388 private void StoreAssetForTaskItemUpdate(TaskInventoryItem taskItem)
389 {
390// m_log.DebugFormat(
391// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
392// m_asset.FullID, taskItem.Name, ourClient.Name);
393
394 m_Scene.AssetService.Store(m_asset);
395 }
396
303 private void DoCreateItem(uint callbackID) 397 private void DoCreateItem(uint callbackID)
304 { 398 {
305 m_Scene.AssetService.Store(m_asset); 399 m_Scene.AssetService.Store(m_asset);
@@ -327,19 +421,5 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
327 else 421 else
328 ourClient.SendAlertMessage("Unable to create inventory item"); 422 ourClient.SendAlertMessage("Unable to create inventory item");
329 } 423 }
330
331 /// <summary>
332 /// Get the asset data uploaded in this transfer.
333 /// </summary>
334 /// <returns>null if the asset has not finished uploading</returns>
335 public AssetBase GetAssetData()
336 {
337 if (m_finished)
338 {
339 return m_asset;
340 }
341
342 return null;
343 }
344 } 424 }
345} 425} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 96e9797..e25fa94 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -345,15 +345,58 @@ namespace OpenSim.Region.Framework.Scenes
345 public event StopScript OnStopScript; 345 public event StopScript OnStopScript;
346 346
347 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); 347 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
348
349 /// <summary>
350 /// Triggered when an object is moved.
351 /// </summary>
352 /// <remarks>
353 /// Triggered by <see cref="TriggerGroupMove"/>
354 /// in <see cref="SceneObjectGroup.UpdateGroupPosition"/>,
355 /// <see cref="SceneObjectGroup.GrabMovement"/>
356 /// </remarks>
348 public event SceneGroupMoved OnSceneGroupMove; 357 public event SceneGroupMoved OnSceneGroupMove;
349 358
350 public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); 359 public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
360
361 /// <summary>
362 /// Triggered when an object is grabbed.
363 /// </summary>
364 /// <remarks>
365 /// Triggered by <see cref="TriggerGroupGrab"/>
366 /// in <see cref="SceneObjectGroup.OnGrabGroup"/>
367 /// via <see cref="SceneObjectGroup.ObjectGrabHandler"/>
368 /// via <see cref="Scene.ProcessObjectGrab"/>
369 /// via <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
370 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectGrab"/>
371 /// </remarks>
351 public event SceneGroupGrabed OnSceneGroupGrab; 372 public event SceneGroupGrabed OnSceneGroupGrab;
352 373
353 public delegate bool SceneGroupSpinStarted(UUID groupID); 374 public delegate bool SceneGroupSpinStarted(UUID groupID);
375
376 /// <summary>
377 /// Triggered when an object starts to spin.
378 /// </summary>
379 /// <remarks>
380 /// Triggered by <see cref="TriggerGroupSpinStart"/>
381 /// in <see cref="SceneObjectGroup.SpinStart"/>
382 /// via <see cref="SceneGraph.SpinStart"/>
383 /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinStart"/>
384 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinStart"/>
385 /// </remarks>
354 public event SceneGroupSpinStarted OnSceneGroupSpinStart; 386 public event SceneGroupSpinStarted OnSceneGroupSpinStart;
355 387
356 public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); 388 public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
389
390 /// <summary>
391 /// Triggered when an object is being spun.
392 /// </summary>
393 /// <remarks>
394 /// Triggered by <see cref="TriggerGroupSpin"/>
395 /// in <see cref="SceneObjectGroup.SpinMovement"/>
396 /// via <see cref="SceneGraph.SpinObject"/>
397 /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinUpdate"/>
398 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinUpdate"/>
399 /// </remarks>
357 public event SceneGroupSpun OnSceneGroupSpin; 400 public event SceneGroupSpun OnSceneGroupSpin;
358 401
359 public delegate void LandObjectAdded(ILandObject newParcel); 402 public delegate void LandObjectAdded(ILandObject newParcel);
@@ -460,36 +503,170 @@ namespace OpenSim.Region.Framework.Scenes
460 } 503 }
461 504
462 /// <summary> 505 /// <summary>
506 /// Triggered when some scene object properties change.
507 /// </summary>
508 /// <remarks>
463 /// ScriptChangedEvent is fired when a scene object property that a script might be interested 509 /// ScriptChangedEvent is fired when a scene object property that a script might be interested
464 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. 510 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
465 /// This is not an indication that the script has changed (see OnUpdateScript for that). 511 /// This is not an indication that the script has changed (see OnUpdateScript for that).
466 /// This event is sent to a script to tell it that some property changed on 512 /// This event is sent to a script to tell it that some property changed on
467 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . 513 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
468 /// </summary> 514 /// Triggered by <see cref="TriggerOnScriptChangedEvent"/>
515 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.TeleportAgentWithinRegion"/>,
516 /// <see cref="SceneObjectPart.TriggerScriptChangedEvent"/>
517 /// </remarks>
469 public event ScriptChangedEvent OnScriptChangedEvent; 518 public event ScriptChangedEvent OnScriptChangedEvent;
470 public delegate void ScriptChangedEvent(uint localID, uint change); 519 public delegate void ScriptChangedEvent(uint localID, uint change);
471 520
472 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); 521 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
522
523 /// <summary>
524 /// Triggered when a script receives control input from an agent.
525 /// </summary>
526 /// <remarks>
527 /// Triggered by <see cref="TriggerControlEvent"/>
528 /// in <see cref="ScenePresence.SendControlsToScripts"/>
529 /// via <see cref="ScenePresence.HandleAgentUpdate"/>
530 /// via <see cref="OpenSim.Framework.IClientAPI.OnAgentUpdate"/>
531 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleAgentUpdate"/>
532 /// </remarks>
473 public event ScriptControlEvent OnScriptControlEvent; 533 public event ScriptControlEvent OnScriptControlEvent;
474 534
475 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 535 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
536
537 /// <summary>
538 /// Triggered when an object has arrived within a tolerance distance
539 /// of a motion target.
540 /// </summary>
541 /// <remarks>
542 /// Triggered by <see cref="TriggerAtTargetEvent"/>
543 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
544 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
545 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
546 /// </remarks>
476 public event ScriptAtTargetEvent OnScriptAtTargetEvent; 547 public event ScriptAtTargetEvent OnScriptAtTargetEvent;
477 548
478 public delegate void ScriptNotAtTargetEvent(uint localID); 549 public delegate void ScriptNotAtTargetEvent(uint localID);
550
551 /// <summary>
552 /// Triggered when an object has a motion target but has not arrived
553 /// within a tolerance distance.
554 /// </summary>
555 /// <remarks>
556 /// Triggered by <see cref="TriggerNotAtTargetEvent"/>
557 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
558 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
559 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
560 /// </remarks>
479 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 561 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
480 562
481 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); 563 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
564
565 /// <summary>
566 /// Triggered when an object has arrived within a tolerance rotation
567 /// of a rotation target.
568 /// </summary>
569 /// <remarks>
570 /// Triggered by <see cref="TriggerAtRotTargetEvent"/>
571 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
572 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
573 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
574 /// </remarks>
482 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; 575 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
483 576
484 public delegate void ScriptNotAtRotTargetEvent(uint localID); 577 public delegate void ScriptNotAtRotTargetEvent(uint localID);
578
579 /// <summary>
580 /// Triggered when an object has a rotation target but has not arrived
581 /// within a tolerance rotation.
582 /// </summary>
583 /// <remarks>
584 /// Triggered by <see cref="TriggerNotAtRotTargetEvent"/>
585 /// in <see cref="SceneObjectGroup.checkAtTargets"/>
586 /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
587 /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
588 /// </remarks>
485 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; 589 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
486 590
487 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 591 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
592
593 /// <summary>
594 /// Triggered when a physical collision has started between a prim
595 /// and something other than the region terrain.
596 /// </summary>
597 /// <remarks>
598 /// Triggered by <see cref="TriggerScriptCollidingStart"/>
599 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
600 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
601 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
602 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
603 /// </remarks>
488 public event ScriptColliding OnScriptColliderStart; 604 public event ScriptColliding OnScriptColliderStart;
605
606 /// <summary>
607 /// Triggered when something that previously collided with a prim has
608 /// not stopped colliding with it.
609 /// </summary>
610 /// <remarks>
611 /// <seealso cref="OnScriptColliderStart"/>
612 /// Triggered by <see cref="TriggerScriptColliding"/>
613 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
614 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
615 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
616 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
617 /// </remarks>
489 public event ScriptColliding OnScriptColliding; 618 public event ScriptColliding OnScriptColliding;
619
620 /// <summary>
621 /// Triggered when something that previously collided with a prim has
622 /// stopped colliding with it.
623 /// </summary>
624 /// <remarks>
625 /// Triggered by <see cref="TriggerScriptCollidingEnd"/>
626 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
627 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
628 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
629 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
630 /// </remarks>
490 public event ScriptColliding OnScriptCollidingEnd; 631 public event ScriptColliding OnScriptCollidingEnd;
632
633 /// <summary>
634 /// Triggered when a physical collision has started between an object
635 /// and the region terrain.
636 /// </summary>
637 /// <remarks>
638 /// Triggered by <see cref="TriggerScriptLandCollidingStart"/>
639 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
640 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
641 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
642 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
643 /// </remarks>
491 public event ScriptColliding OnScriptLandColliderStart; 644 public event ScriptColliding OnScriptLandColliderStart;
645
646 /// <summary>
647 /// Triggered when an object that previously collided with the region
648 /// terrain has not yet stopped colliding with it.
649 /// </summary>
650 /// <remarks>
651 /// Triggered by <see cref="TriggerScriptLandColliding"/>
652 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
653 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
654 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
655 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
656 /// </remarks>
492 public event ScriptColliding OnScriptLandColliding; 657 public event ScriptColliding OnScriptLandColliding;
658
659 /// <summary>
660 /// Triggered when an object that previously collided with the region
661 /// terrain has stopped colliding with it.
662 /// </summary>
663 /// <remarks>
664 /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/>
665 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
666 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
667 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
668 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
669 /// </remarks>
493 public event ScriptColliding OnScriptLandColliderEnd; 670 public event ScriptColliding OnScriptLandColliderEnd;
494 671
495 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 672 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
@@ -550,6 +727,13 @@ namespace OpenSim.Region.Framework.Scenes
550 727
551 /* 728 /*
552 public delegate void ScriptTimerEvent(uint localID, double timerinterval); 729 public delegate void ScriptTimerEvent(uint localID, double timerinterval);
730 /// <summary>
731 /// Used to be triggered when the LSL timer event fires.
732 /// </summary>
733 /// <remarks>
734 /// Triggered by <see cref="TriggerTimerEvent"/>
735 /// via <see cref="SceneObjectPart.handleTimerAccounting"/>
736 /// </remarks>
553 public event ScriptTimerEvent OnScriptTimerEvent; 737 public event ScriptTimerEvent OnScriptTimerEvent;
554 */ 738 */
555 739
@@ -2293,7 +2477,11 @@ namespace OpenSim.Region.Framework.Scenes
2293 } 2477 }
2294 } 2478 }
2295 2479
2296 // this lets us keep track of nasty script events like timer, etc. 2480 /// <summary>
2481 /// this lets us keep track of nasty script events like timer, etc.
2482 /// </summary>
2483 /// <param name="objLocalID"></param>
2484 /// <param name="Interval"></param>
2297 public void TriggerTimerEvent(uint objLocalID, double Interval) 2485 public void TriggerTimerEvent(uint objLocalID, double Interval)
2298 { 2486 {
2299 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"); 2487 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");