aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs55
2 files changed, 21 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ed04e44..1a05bd9 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -524,7 +524,7 @@ namespace OpenSim.Region.Environment.Scenes
524 if (group != null) 524 if (group != null)
525 { 525 {
526 // TODO Retrieve itemID from client's inventory to pass on 526 // TODO Retrieve itemID from client's inventory to pass on
527 //group.AddInventoryItem(rmoteClient, primLocalID, null); 527 //group.AddInventoryItem(remoteClient, primLocalID, null);
528 MainLog.Instance.Verbose( 528 MainLog.Instance.Verbose(
529 "PRIMINVENTORY", 529 "PRIMINVENTORY",
530 "UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}", 530 "UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}",
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index fb09932..b72d743 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -109,20 +109,32 @@ namespace OpenSim.Region.Environment.Scenes
109 } 109 }
110 } 110 }
111 111
112 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) 112 /// <summary>
113 /// Add an inventory item to a prim in this group.
114 /// </summary>
115 /// <param name="remoteClient"></param>
116 /// <param name="localID"></param>
117 /// <param name="item"></param>
118 /// <param name="copyItemID">The item UUID that should be used by the new item.</param>
119 /// <returns></returns>
120 public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
121 InventoryItemBase item, LLUUID copyItemID)
113 { 122 {
123 LLUUID newItemId = ((copyItemID != null) ? copyItemID : item.inventoryID);
124
114 SceneObjectPart part = GetChildPart(localID); 125 SceneObjectPart part = GetChildPart(localID);
115 if (part != null) 126 if (part != null)
116 { 127 {
117 TaskInventoryItem taskItem = new TaskInventoryItem(); 128 TaskInventoryItem taskItem = new TaskInventoryItem();
118 taskItem.item_id = item.inventoryID; 129
130 taskItem.item_id = newItemId;
119 taskItem.asset_id = item.assetID; 131 taskItem.asset_id = item.assetID;
120 taskItem.name = item.inventoryName; 132 taskItem.name = item.inventoryName;
121 taskItem.desc = item.inventoryDescription; 133 taskItem.desc = item.inventoryDescription;
122 taskItem.owner_id = item.avatarID; 134 taskItem.owner_id = item.avatarID;
123 taskItem.creator_id = item.creatorsID; 135 taskItem.creator_id = item.creatorsID;
124 taskItem.type = TaskInventoryItem.Types[item.assetType]; 136 taskItem.type = TaskInventoryItem.Types[item.assetType];
125 taskItem.inv_type = TaskInventoryItem.Types[item.invType]; 137 taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType];
126 part.AddInventoryItem(taskItem); 138 part.AddInventoryItem(taskItem);
127 139
128 // It might seem somewhat crude to update the whole group for a single prim inventory change, 140 // It might seem somewhat crude to update the whole group for a single prim inventory change,
@@ -134,41 +146,14 @@ namespace OpenSim.Region.Environment.Scenes
134 146
135 return true; 147 return true;
136 } 148 }
137 return false;
138 }
139
140 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
141 {
142 if (copyItemID != LLUUID.Zero)
143 {
144 SceneObjectPart part = GetChildPart(localID);
145 if (part != null)
146 {
147 TaskInventoryItem taskItem = new TaskInventoryItem();
148 taskItem.item_id = copyItemID;
149 taskItem.asset_id = item.assetID;
150 taskItem.name = item.inventoryName;
151 taskItem.desc = item.inventoryDescription;
152 taskItem.owner_id = new LLUUID(item.avatarID.ToString());
153 taskItem.creator_id = new LLUUID(item.creatorsID.ToString());
154 taskItem.type = TaskInventoryItem.Types[item.assetType];
155 taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType];
156 part.AddInventoryItem(taskItem);
157
158 // It might seem somewhat crude to update the whole group for a single prim inventory change,
159 // but it's possible that other prim inventory changes will take place before the region
160 // persistence thread visits this object. In the future, changes can be signalled at a more
161 // granular level, or we could let the datastore worry about whether prims have really
162 // changed since they were last persisted.
163 HasChanged = true;
164
165 return true;
166 }
167 }
168 else 149 else
169 { 150 {
170 return AddInventoryItem(remoteClient, localID, item); 151 MainLog.Instance.Error(
152 "PRIMINVENTORY",
153 "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
154 localID, Name, UUID, newItemId);
171 } 155 }
156
172 return false; 157 return false;
173 } 158 }
174 159