diff options
author | Justin Clarke Casey | 2008-01-07 22:11:26 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-07 22:11:26 +0000 |
commit | 348b79d801a44086413fcf4a781ffa8c4f4b36b6 (patch) | |
tree | 6384f92a4e7eb0606fe9af1d322b20edfcecdf6b | |
parent | * Added Tribal Media to CONTRIBUTORS.txt (diff) | |
download | opensim-SC_OLD-348b79d801a44086413fcf4a781ffa8c4f4b36b6.zip opensim-SC_OLD-348b79d801a44086413fcf4a781ffa8c4f4b36b6.tar.gz opensim-SC_OLD-348b79d801a44086413fcf4a781ffa8c4f4b36b6.tar.bz2 opensim-SC_OLD-348b79d801a44086413fcf4a781ffa8c4f4b36b6.tar.xz |
Trigger persistence of the scripts in a prim's inventory when that inventory is changed/updated/deleted (before the trigger only happened if the prim was moved).
This is still development code - experimental prim inventory persistence cannot yet be enabled by users.
3 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2e8f5f7..ed04e44 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -49,9 +49,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
49 | group.StartScripts(); | 49 | group.StartScripts(); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | |||
53 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete | ||
54 | // or at least some of they can be moved somewhere else | ||
55 | 52 | ||
56 | /// <summary> | 53 | /// <summary> |
57 | /// Add an inventory item to an avatar's inventory. | 54 | /// Add an inventory item to an avatar's inventory. |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 1d382fa..fb09932 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -124,6 +124,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
124 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | 124 | taskItem.type = TaskInventoryItem.Types[item.assetType]; |
125 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; | 125 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; |
126 | part.AddInventoryItem(taskItem); | 126 | part.AddInventoryItem(taskItem); |
127 | |||
128 | // It might seem somewhat crude to update the whole group for a single prim inventory change, | ||
129 | // but it's possible that other prim inventory changes will take place before the region | ||
130 | // persistence thread visits this object. In the future, changes can be signalled at a more | ||
131 | // granular level, or we could let the datastore worry about whether prims have really | ||
132 | // changed since they were last persisted. | ||
133 | HasChanged = true; | ||
134 | |||
127 | return true; | 135 | return true; |
128 | } | 136 | } |
129 | return false; | 137 | return false; |
@@ -146,6 +154,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
146 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | 154 | taskItem.type = TaskInventoryItem.Types[item.assetType]; |
147 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; | 155 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; |
148 | part.AddInventoryItem(taskItem); | 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 | |||
149 | return true; | 165 | return true; |
150 | } | 166 | } |
151 | } | 167 | } |
@@ -160,9 +176,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
160 | { | 176 | { |
161 | SceneObjectPart part = GetChildPart(localID); | 177 | SceneObjectPart part = GetChildPart(localID); |
162 | if (part != null) | 178 | if (part != null) |
163 | { | 179 | { |
164 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | 180 | int type = part.RemoveInventoryItem(remoteClient, localID, itemID); |
181 | |||
182 | // It might seem somewhat crude to update the whole group for a single prim inventory change, | ||
183 | // but it's possible that other prim inventory changes will take place before the region | ||
184 | // persistence thread visits this object. In the future, changes can be signalled at a more | ||
185 | // granular level, or we could let the datastore worry about whether prims have really | ||
186 | // changed since they were last persisted. | ||
187 | HasChanged = true; | ||
188 | |||
189 | return type; | ||
165 | } | 190 | } |
191 | |||
166 | return -1; | 192 | return -1; |
167 | } | 193 | } |
168 | } | 194 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index c282780..9e2c256 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -174,6 +174,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
174 | m_inventorySerial++; | 174 | m_inventorySerial++; |
175 | } | 175 | } |
176 | 176 | ||
177 | /// <summary> | ||
178 | /// Remove an item from this prim's inventory | ||
179 | /// </summary> | ||
180 | /// <param name="remoteClient"></param> | ||
181 | /// <param name="localID"></param> | ||
182 | /// <param name="itemID"></param> | ||
183 | /// <returns>Numeric asset type of the item removed.</returns> | ||
177 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | 184 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
178 | { | 185 | { |
179 | if (localID == LocalID) | 186 | if (localID == LocalID) |
@@ -183,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
183 | string type = m_taskInventory[itemID].inv_type; | 190 | string type = m_taskInventory[itemID].inv_type; |
184 | m_taskInventory.Remove(itemID); | 191 | m_taskInventory.Remove(itemID); |
185 | m_inventorySerial++; | 192 | m_inventorySerial++; |
186 | if (type == "lsl_text") | 193 | if (type == "lsltext") |
187 | { | 194 | { |
188 | return 10; | 195 | return 10; |
189 | } | 196 | } |