diff options
author | Sean Dague | 2007-12-05 18:58:55 +0000 |
---|---|---|
committer | Sean Dague | 2007-12-05 18:58:55 +0000 |
commit | c5c0df74e61666d56fbbe33c4bfe5cd98482cacb (patch) | |
tree | ec1477da6e614e62f95bf729aae557b6ad84e827 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |
parent | From Gary Chernega (IBM) (diff) | |
download | opensim-SC-c5c0df74e61666d56fbbe33c4bfe5cd98482cacb.zip opensim-SC-c5c0df74e61666d56fbbe33c4bfe5cd98482cacb.tar.gz opensim-SC-c5c0df74e61666d56fbbe33c4bfe5cd98482cacb.tar.bz2 opensim-SC-c5c0df74e61666d56fbbe33c4bfe5cd98482cacb.tar.xz |
Do not create a new asset on item metadata change
From Justin Casey (IBM)
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index cf845a6..d8abe90 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -128,46 +128,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
128 | { | 128 | { |
129 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 129 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
130 | if (item != null) | 130 | if (item != null) |
131 | { | 131 | { |
132 | AssetBase asset = null; | ||
133 | bool addAsset = false; | ||
134 | |||
135 | // If we're not inside a transaction and an existing asset is attached | ||
136 | // to the update item, then we need to create a new asset for the new details | ||
137 | if (LLUUID.Zero == transactionID) | 132 | if (LLUUID.Zero == transactionID) |
138 | { | 133 | { |
139 | asset = AssetCache.GetAsset(item.assetID); | 134 | item.inventoryName = name; |
135 | item.inventoryDescription = description; | ||
136 | item.inventoryNextPermissions = nextOwnerMask; | ||
140 | 137 | ||
141 | if (asset != null) | 138 | userInfo.UpdateItem(remoteClient.AgentId, item); |
142 | { | ||
143 | // to update an item we need to create a new asset | ||
144 | // it's possible that this could be optimized to an update if we knew | ||
145 | // that the owner's inventory had the only copy of the item (I believe | ||
146 | // we're using copy on write semantics). | ||
147 | item.inventoryName = asset.Name = name; | ||
148 | item.inventoryDescription = asset.Description = description; | ||
149 | item.inventoryNextPermissions = nextOwnerMask; | ||
150 | item.assetID = asset.FullID = LLUUID.Random(); | ||
151 | |||
152 | addAsset = true; | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | MainLog.Instance.Warn( | ||
157 | "Asset ID " + item.assetID + " not found for item ID " + itemID | ||
158 | + " named " + item.inventoryName + " for an inventory item update."); | ||
159 | return; | ||
160 | } | ||
161 | } | 139 | } |
162 | else | 140 | else |
163 | { | 141 | { |
164 | AgentAssetTransactions transactions | 142 | AgentAssetTransactions transactions |
165 | = CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | 143 | = CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); |
166 | 144 | ||
167 | if (transactions != null) | 145 | if (transactions != null) |
168 | { | 146 | { |
169 | LLUUID assetID = transactionID.Combine(remoteClient.SecureSessionId); | 147 | LLUUID assetID = transactionID.Combine(remoteClient.SecureSessionId); |
170 | asset = AssetCache.GetAsset(assetID); | 148 | AssetBase asset = AssetCache.GetAsset(assetID); |
171 | 149 | ||
172 | if (asset == null) | 150 | if (asset == null) |
173 | { | 151 | { |
@@ -182,30 +160,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
182 | asset.Type = (sbyte) item.assetType; | 160 | asset.Type = (sbyte) item.assetType; |
183 | item.assetID = asset.FullID; | 161 | item.assetID = asset.FullID; |
184 | 162 | ||
185 | addAsset = true; | 163 | AssetCache.AddAsset(asset); |
186 | } | 164 | } |
165 | |||
166 | userInfo.UpdateItem(remoteClient.AgentId, item); | ||
187 | } | 167 | } |
188 | } | 168 | } |
189 | |||
190 | if (asset != null) | ||
191 | { | ||
192 | if (addAsset) | ||
193 | { | ||
194 | AssetCache.AddAsset(asset); | ||
195 | } | ||
196 | |||
197 | userInfo.UpdateItem(remoteClient.AgentId, item); | ||
198 | } | ||
199 | } | 169 | } |
200 | else | 170 | else |
201 | { | 171 | { |
202 | MainLog.Instance.Warn( | 172 | MainLog.Instance.Warn( |
173 | "INVENTORY", | ||
203 | "Item ID " + itemID + " not found for an inventory item update."); | 174 | "Item ID " + itemID + " not found for an inventory item update."); |
204 | } | 175 | } |
205 | } | 176 | } |
206 | else | 177 | else |
207 | { | 178 | { |
208 | MainLog.Instance.Warn( | 179 | MainLog.Instance.Warn( |
180 | "INVENTORY", | ||
209 | "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); | 181 | "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); |
210 | } | 182 | } |
211 | } | 183 | } |