aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs82
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs98
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs107
6 files changed, 241 insertions, 57 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 0935b43..8c0ba3c 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
433 } 433 }
434 } 434 }
435 return returnResult; 435 return returnResult;
436 } 436 }
437 437
438 public SceneObjectPart GetSceneObjectPart(uint localID) 438 public SceneObjectPart GetSceneObjectPart(uint localID)
439 { 439 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 1a05bd9..db3da48 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -58,7 +58,9 @@ namespace OpenSim.Region.Environment.Scenes
58 /// in which the item is to be placed.</param> 58 /// in which the item is to be placed.</param>
59 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 59 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
60 { 60 {
61 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 61 CachedUserInfo userInfo
62 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
63
62 if (userInfo != null) 64 if (userInfo != null)
63 { 65 {
64 userInfo.AddItem(remoteClient.AgentId, item); 66 userInfo.AddItem(remoteClient.AgentId, item);
@@ -157,28 +159,47 @@ namespace OpenSim.Region.Environment.Scenes
157 /// <param name="itemID"></param> 159 /// <param name="itemID"></param>
158 /// <param name="primID">The prim which contains the item to update</param> 160 /// <param name="primID">The prim which contains the item to update</param>
159 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> 161 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
160 /// <param name="data"></param> 162 /// <param name="data"></param>
161 /// <returns>Asset LLUID created</returns>
162 public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId, 163 public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId,
163 LLUUID primId, bool isScriptRunning, byte[] data) 164 LLUUID primId, bool isScriptRunning, byte[] data)
164 { 165 {
165 // TODO Not currently doing anything with the isScriptRunning bool 166 // Retrieve group
167 SceneObjectPart part = GetSceneObjectPart(primId);
168 SceneObjectGroup group = part.ParentGroup;
169 if (null == group)
170 {
171 MainLog.Instance.Error(
172 "PRIMINVENTORY",
173 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
174 itemId, primId);
166 175
167 MainLog.Instance.Verbose( 176 return;
168 "PRIMINVENTORY", 177 }
169 "Prim inventory script save functionality not yet implemented." 178
170 + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}",
171 remoteClient, itemId, primId, isScriptRunning);
172
173 // TODO
174 // Retrieve client LLUID
175 // Retrieve sog containing primID
176 // Retrieve item 179 // Retrieve item
177 // Create new asset and add to cache 180 TaskInventoryItem item = group.GetInventoryItem(part.LocalID, itemId);
181 if (null == item)
182 {
183 return;
184 }
185
186 // Create new asset
187 // XXX Hardcoding the numbers is a temporary measure - need an enumeration for this
188 AssetBase asset =
189 CreateAsset(item.name, item.desc, 10, 10, data);
190 AssetCache.AddAsset(asset);
191
178 // Update item with new asset 192 // Update item with new asset
179 // Trigger SOG update (see RezScript) 193 item.asset_id = asset.FullID;
180 // Trigger rerunning of script (use TriggerRezScript event, see RezScript) 194 group.UpdateInventoryItem(item);
181 // return new asset id 195 group.GetProperites(remoteClient);
196
197 // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
198 if (isScriptRunning)
199 {
200 group.StopScript(part.LocalID, item.item_id);
201 group.StartScript(part.LocalID, item.item_id);
202 }
182 } 203 }
183 204
184 /// <summary> 205 /// <summary>
@@ -268,14 +289,14 @@ namespace OpenSim.Region.Environment.Scenes
268 } 289 }
269 else 290 else
270 { 291 {
271 MainLog.Instance.Warn( 292 MainLog.Instance.Error(
272 "AGENTINVENTORY", 293 "AGENTINVENTORY",
273 "Item ID " + itemID + " not found for an inventory item update."); 294 "Item ID " + itemID + " not found for an inventory item update.");
274 } 295 }
275 } 296 }
276 else 297 else
277 { 298 {
278 MainLog.Instance.Warn( 299 MainLog.Instance.Error(
279 "AGENTINVENTORY", 300 "AGENTINVENTORY",
280 "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); 301 "Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
281 } 302 }
@@ -290,7 +311,7 @@ namespace OpenSim.Region.Environment.Scenes
290 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); 311 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
291 if (userInfo == null) 312 if (userInfo == null)
292 { 313 {
293 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString()); 314 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString());
294 return; 315 return;
295 } 316 }
296 317
@@ -299,13 +320,13 @@ namespace OpenSim.Region.Environment.Scenes
299 item = userInfo.RootFolder.HasItem(oldItemID); 320 item = userInfo.RootFolder.HasItem(oldItemID);
300 if (item == null) 321 if (item == null)
301 { 322 {
302 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); 323 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
303 return; 324 return;
304 } 325 }
305 } 326 }
306 else 327 else
307 { 328 {
308 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); 329 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString());
309 return; 330 return;
310 } 331 }
311 } 332 }
@@ -346,7 +367,7 @@ namespace OpenSim.Region.Environment.Scenes
346 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 367 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
347 if (userInfo == null) 368 if (userInfo == null)
348 { 369 {
349 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString()); 370 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString());
350 return; 371 return;
351 } 372 }
352 373
@@ -367,13 +388,13 @@ namespace OpenSim.Region.Environment.Scenes
367 } 388 }
368 else 389 else
369 { 390 {
370 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString()); 391 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString());
371 return; 392 return;
372 } 393 }
373 } 394 }
374 else 395 else
375 { 396 {
376 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder"); 397 MainLog.Instance.Error("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder");
377 return; 398 return;
378 } 399 }
379 } 400 }
@@ -476,7 +497,7 @@ namespace OpenSim.Region.Environment.Scenes
476 } 497 }
477 else 498 else
478 { 499 {
479 MainLog.Instance.Warn( 500 MainLog.Instance.Error(
480 "PRIMINVENTORY", "Inventory requested of prim {0} which doesn't exist", primLocalID); 501 "PRIMINVENTORY", "Inventory requested of prim {0} which doesn't exist", primLocalID);
481 } 502 }
482 } 503 }
@@ -484,7 +505,8 @@ namespace OpenSim.Region.Environment.Scenes
484 /// <summary> 505 /// <summary>
485 /// Remove an item from a prim (task) inventory 506 /// Remove an item from a prim (task) inventory
486 /// </summary> 507 /// </summary>
487 /// <param name="remoteClient"></param> 508 /// <param name="remoteClient">Unused at the moment but retained since the avatar ID might
509 /// be necessary for a permissions check at some stage.</param>
488 /// <param name="itemID"></param> 510 /// <param name="itemID"></param>
489 /// <param name="localID"></param> 511 /// <param name="localID"></param>
490 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 512 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
@@ -492,7 +514,7 @@ namespace OpenSim.Region.Environment.Scenes
492 SceneObjectGroup group = GetGroupByPrim(localID); 514 SceneObjectGroup group = GetGroupByPrim(localID);
493 if (group != null) 515 if (group != null)
494 { 516 {
495 int type = group.RemoveInventoryItem(remoteClient, localID, itemID); 517 int type = group.RemoveInventoryItem(localID, itemID);
496 group.GetProperites(remoteClient); 518 group.GetProperites(remoteClient);
497 if (type == 10) 519 if (type == 10)
498 { 520 {
@@ -501,7 +523,7 @@ namespace OpenSim.Region.Environment.Scenes
501 } 523 }
502 else 524 else
503 { 525 {
504 MainLog.Instance.Warn( 526 MainLog.Instance.Error(
505 "PRIMINVENTORY", 527 "PRIMINVENTORY",
506 "Removal of item {0} requested of prim {1} but this prim does not exist", 528 "Removal of item {0} requested of prim {1} but this prim does not exist",
507 itemID, 529 itemID,
@@ -752,4 +774,4 @@ namespace OpenSim.Region.Environment.Scenes
752 rootPart.ScheduleFullUpdate(); 774 rootPart.ScheduleFullUpdate();
753 } 775 }
754 } 776 }
755} \ No newline at end of file 777}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 647fbf4..5a7d4de 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
176 agentData.AgentID = avatarID; 176 agentData.AgentID = avatarID;
177 agentData.QueryID = RequestID; 177 agentData.QueryID = RequestID;
178 replyPacket.AgentData = agentData; 178 replyPacket.AgentData = agentData;
179 byte[] bytes = new byte[AvatarResponses.Count*32]; 179 //byte[] bytes = new byte[AvatarResponses.Count*32];
180 180
181 int i = 0; 181 int i = 0;
182 foreach (AvatarPickerAvatar item in AvatarResponses) 182 foreach (AvatarPickerAvatar item in AvatarResponses)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index b72d743..4d25b5d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -60,6 +60,27 @@ namespace OpenSim.Region.Environment.Scenes
60 } 60 }
61 } 61 }
62 62
63// /// Start a given script.
64// /// </summary>
65// /// <param name="localID">
66// /// A <see cref="System.UInt32"/>
67// /// </param>
68// public void StartScript(LLUUID partID, LLUUID itemID)
69// {
70// SceneObjectPart part = GetChildPart(partID);
71// if (part != null)
72// {
73// part.StartScript(itemID);
74// }
75// else
76// {
77// MainLog.Instance.Error(
78// "PRIMINVENTORY",
79// "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}",
80// localID, Name, UUID, itemID);
81// }
82// }
83
63 /// <summary> 84 /// <summary>
64 /// Start the scripts contained in all the prims in this group. 85 /// Start the scripts contained in all the prims in this group.
65 /// </summary> 86 /// </summary>
@@ -71,6 +92,27 @@ namespace OpenSim.Region.Environment.Scenes
71 } 92 }
72 } 93 }
73 94
95 /// Start a given script.
96 /// </summary>
97 /// <param name="localID">
98 /// A <see cref="System.UInt32"/>
99 /// </param>
100 public void StopScript(uint partID, LLUUID itemID)
101 {
102 SceneObjectPart part = GetChildPart(partID);
103 if (part != null)
104 {
105 part.StopScript(itemID);
106 }
107 else
108 {
109 MainLog.Instance.Error(
110 "PRIMINVENTORY",
111 "Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}",
112 partID, Name, UUID, itemID);
113 }
114 }
115
74 /// <summary> 116 /// <summary>
75 /// 117 ///
76 /// </summary> 118 /// </summary>
@@ -156,13 +198,63 @@ namespace OpenSim.Region.Environment.Scenes
156 198
157 return false; 199 return false;
158 } 200 }
201
202 /// <summary>
203 /// Returns an existing inventory item. Returns the original, so any changes will be live.
204 /// </summary>
205 /// <param name="primID"></param>
206 /// <param name="itemID"></param>
207 /// <returns>null if the item does not exist</returns>
208 public TaskInventoryItem GetInventoryItem(uint primID, LLUUID itemID)
209 {
210 SceneObjectPart part = GetChildPart(primID);
211 if (part != null)
212 {
213 return part.GetInventoryItem(itemID);
214 }
215 else
216 {
217 MainLog.Instance.Error(
218 "PRIMINVENTORY",
219 "Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}",
220 primID, part.Name, part.UUID, itemID);
221 }
222
223 return null;
224 }
225
226 /// <summary>
227 /// Update an existing inventory item.
228 /// </summary>
229 /// <param name="item">The updated item. An item with the same id must already exist
230 /// in this prim's inventory</param>
231 /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
232 public bool UpdateInventoryItem(TaskInventoryItem item)
233 {
234 SceneObjectPart part = GetChildPart(item.ParentPartID);
235 if (part != null)
236 {
237 part.UpdateInventoryItem(item);
238
239 return true;
240 }
241 else
242 {
243 MainLog.Instance.Error(
244 "PRIMINVENTORY",
245 "Couldn't find prim ID {0} to update item {1}, {2}",
246 item.ParentPartID, item.name, item.item_id);
247 }
248
249 return false;
250 }
159 251
160 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 252 public int RemoveInventoryItem(uint localID, LLUUID itemID)
161 { 253 {
162 SceneObjectPart part = GetChildPart(localID); 254 SceneObjectPart part = GetChildPart(localID);
163 if (part != null) 255 if (part != null)
164 { 256 {
165 int type = part.RemoveInventoryItem(remoteClient, localID, itemID); 257 int type = part.RemoveInventoryItem(itemID);
166 258
167 // It might seem somewhat crude to update the whole group for a single prim inventory change, 259 // It might seem somewhat crude to update the whole group for a single prim inventory change,
168 // but it's possible that other prim inventory changes will take place before the region 260 // but it's possible that other prim inventory changes will take place before the region
@@ -177,4 +269,4 @@ namespace OpenSim.Region.Environment.Scenes
177 return -1; 269 return -1;
178 } 270 }
179 } 271 }
180} \ No newline at end of file 272}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index e8d12ff..c623e55 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -375,8 +375,9 @@ namespace OpenSim.Region.Environment.Scenes
375 375
376 foreach (SceneObjectPart part in m_parts.Values) 376 foreach (SceneObjectPart part in m_parts.Values)
377 { 377 {
378 Vector3 partPosition = 378 // Temporary commented to stop compiler warning
379 new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); 379 //Vector3 partPosition =
380 // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
380 Quaternion parentrotation = 381 Quaternion parentrotation =
381 new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z); 382 new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
382 383
@@ -827,10 +828,8 @@ namespace OpenSim.Region.Environment.Scenes
827 /// <returns></returns> 828 /// <returns></returns>
828 public bool HasChildPrim(LLUUID primID) 829 public bool HasChildPrim(LLUUID primID)
829 { 830 {
830 SceneObjectPart childPart = null;
831 if (m_parts.ContainsKey(primID)) 831 if (m_parts.ContainsKey(primID))
832 { 832 {
833 childPart = m_parts[primID];
834 return true; 833 return true;
835 } 834 }
836 return false; 835 return false;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 9e2c256..5d197e3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -144,7 +144,26 @@ namespace OpenSim.Region.Environment.Scenes
144 itemId, Name, UUID); 144 itemId, Name, UUID);
145 } 145 }
146 146
147 } 147 }
148
149 /// <summary>
150 /// Stop a script which is in this prim's inventory.
151 /// </summary>
152 /// <param name="itemId"></param>
153 public void StopScript(LLUUID itemId)
154 {
155 if (m_taskInventory.ContainsKey(itemId))
156 {
157 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
158 }
159 else
160 {
161 MainLog.Instance.Error(
162 "PRIMINVENTORY",
163 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}",
164 itemId, Name, UUID);
165 }
166 }
148 167
149 /// <summary> 168 /// <summary>
150 /// Add an item to this prim's inventory. 169 /// Add an item to this prim's inventory.
@@ -173,33 +192,85 @@ namespace OpenSim.Region.Environment.Scenes
173 192
174 m_inventorySerial++; 193 m_inventorySerial++;
175 } 194 }
195
196 /// <summary>
197 /// Returns an existing inventory item. Returns the original, so any changes will be live.
198 /// </summary>
199 /// <param name="itemID"></param>
200 /// <returns>null if the item does not exist</returns>
201 public TaskInventoryItem GetInventoryItem(LLUUID itemID)
202 {
203 if (m_taskInventory.ContainsKey(itemID))
204 {
205 return m_taskInventory[itemID];
206 }
207 else
208 {
209 MainLog.Instance.Error(
210 "PRIMINVENTORY",
211 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
212 itemID, Name, UUID);
213 }
214
215 return null;
216 }
217
218 /// <summary>
219 /// Update an existing inventory item.
220 /// </summary>
221 /// <param name="item">The updated item. An item with the same id must already exist
222 /// in this prim's inventory.</param>
223 /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
224 public bool UpdateInventoryItem(TaskInventoryItem item)
225 {
226 if (m_taskInventory.ContainsKey(item.item_id))
227 {
228 m_taskInventory[item.item_id] = item;
229 m_inventorySerial++;
230
231 return true;
232 }
233 else
234 {
235 MainLog.Instance.Error(
236 "PRIMINVENTORY",
237 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
238 item.item_id, Name, UUID);
239 }
240
241 return false;
242 }
176 243
177 /// <summary> 244 /// <summary>
178 /// Remove an item from this prim's inventory 245 /// Remove an item from this prim's inventory
179 /// </summary> 246 /// </summary>
180 /// <param name="remoteClient"></param>
181 /// <param name="localID"></param>
182 /// <param name="itemID"></param> 247 /// <param name="itemID"></param>
183 /// <returns>Numeric asset type of the item removed.</returns> 248 /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist
184 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 249 /// in this prim's inventory.</returns>
250 public int RemoveInventoryItem(LLUUID itemID)
185 { 251 {
186 if (localID == LocalID) 252 if (m_taskInventory.ContainsKey(itemID))
187 { 253 {
188 if (m_taskInventory.ContainsKey(itemID)) 254 string type = m_taskInventory[itemID].inv_type;
255 m_taskInventory.Remove(itemID);
256 m_inventorySerial++;
257 if (type == "lsltext")
258 {
259 return 10;
260 }
261 else
189 { 262 {
190 string type = m_taskInventory[itemID].inv_type; 263 return 0;
191 m_taskInventory.Remove(itemID);
192 m_inventorySerial++;
193 if (type == "lsltext")
194 {
195 return 10;
196 }
197 else
198 {
199 return 0;
200 }
201 } 264 }
202 } 265 }
266 else
267 {
268 MainLog.Instance.Error(
269 "PRIMINVENTORY",
270 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
271 itemID, Name, UUID);
272 }
273
203 return -1; 274 return -1;
204 } 275 }
205 276