aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-08-16 16:31:32 +0000
committerMW2007-08-16 16:31:32 +0000
commit531f64a53bbd084dd8d0b33ae6c49821c74d718a (patch)
tree6e515f4d52a974b72a229f1fbc39253a7ba2a8a0
parentI will get it right, honestly! (diff)
downloadopensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.zip
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.gz
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.bz2
opensim-SC_OLD-531f64a53bbd084dd8d0b33ae6c49821c74d718a.tar.xz
Taking Prims (SceneObjectGroups) in and out of inventory should now work and if left in inventory will still be there after restarts. (as with the rest of inventory it will only fully work in standalone mode with account authentication turned on).
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs69
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs16
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs20
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs1
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs9
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs17
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs6
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs3
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs1
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs8
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs12
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs24
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs5
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs107
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs104
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs1
18 files changed, 323 insertions, 93 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 3866e21..c08bef2 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -137,6 +137,16 @@ namespace OpenSim.Framework.Communications.Caches
137 return asset; 137 return asset;
138 } 138 }
139 139
140 public AssetBase GetAsset(LLUUID assetID, bool isTexture)
141 {
142 AssetBase asset = GetAsset(assetID);
143 if (asset == null)
144 {
145 this._assetServer.RequestAsset(assetID, isTexture);
146 }
147 return asset;
148 }
149
140 public void AddAsset(AssetBase asset) 150 public void AddAsset(AssetBase asset)
141 { 151 {
142 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 152 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
@@ -241,44 +251,51 @@ namespace OpenSim.Framework.Communications.Caches
241 if (IsTexture) 251 if (IsTexture)
242 { 252 {
243 // Console.WriteLine("asset recieved from asset server"); 253 // Console.WriteLine("asset recieved from asset server");
254
244 TextureImage image = new TextureImage(asset); 255 TextureImage image = new TextureImage(asset);
245 this.Textures.Add(image.FullID, image); 256 if (!this.Textures.ContainsKey(image.FullID))
246 if (this.RequestedTextures.ContainsKey(image.FullID))
247 { 257 {
248 AssetRequest req = this.RequestedTextures[image.FullID]; 258 this.Textures.Add(image.FullID, image);
249 req.ImageInfo = image; 259 if (this.RequestedTextures.ContainsKey(image.FullID))
250 if (image.Data.LongLength > 600)
251 {
252 //over 600 bytes so split up file
253 req.NumPackets = 1 + (int)(image.Data.Length - 600 ) / 1000;
254 }
255 else
256 { 260 {
257 req.NumPackets = 1; 261 AssetRequest req = this.RequestedTextures[image.FullID];
262 req.ImageInfo = image;
263 if (image.Data.LongLength > 600)
264 {
265 //over 600 bytes so split up file
266 req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000;
267 }
268 else
269 {
270 req.NumPackets = 1;
271 }
272 this.RequestedTextures.Remove(image.FullID);
273 this.TextureRequests.Add(req);
258 } 274 }
259 this.RequestedTextures.Remove(image.FullID);
260 this.TextureRequests.Add(req);
261 } 275 }
262 } 276 }
263 else 277 else
264 { 278 {
265 AssetInfo assetInf = new AssetInfo(asset); 279 AssetInfo assetInf = new AssetInfo(asset);
266 this.Assets.Add(assetInf.FullID, assetInf); 280 if (!this.Assets.ContainsKey(assetInf.FullID))
267 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
268 { 281 {
269 AssetRequest req = this.RequestedAssets[assetInf.FullID]; 282 this.Assets.Add(assetInf.FullID, assetInf);
270 req.AssetInf = assetInf; 283 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
271 if (assetInf.Data.LongLength > 600)
272 {
273 //over 600 bytes so split up file
274 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
275 }
276 else
277 { 284 {
278 req.NumPackets = 1; 285 AssetRequest req = this.RequestedAssets[assetInf.FullID];
286 req.AssetInf = assetInf;
287 if (assetInf.Data.LongLength > 600)
288 {
289 //over 600 bytes so split up file
290 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
291 }
292 else
293 {
294 req.NumPackets = 1;
295 }
296 this.RequestedAssets.Remove(assetInf.FullID);
297 this.AssetRequests.Add(req);
279 } 298 }
280 this.RequestedAssets.Remove(assetInf.FullID);
281 this.AssetRequests.Add(req);
282 } 299 }
283 } 300 }
284 } 301 }
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9970d80..ddb5658 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -105,13 +105,27 @@ namespace OpenSim.Framework.Communications.Caches
105 } 105 }
106 } 106 }
107 107
108 public void updateItem(LLUUID userID, InventoryItemBase itemInfo) 108 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
109 { 109 {
110 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 110 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
111 { 111 {
112 this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo); 112 this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
113 } 113 }
114 } 114 }
115
116 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
117 {
118 bool result = false;
119 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
120 {
121 result = RootFolder.DeleteItem(item.inventoryID);
122 if (result)
123 {
124 this.m_parentCommsManager.InventoryServer.DeleteInventoryItem(userID, item);
125 }
126 }
127 return result;
128 }
115 } 129 }
116 130
117 131
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index 6b0e2b4..34f83db 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -90,6 +90,26 @@ namespace OpenSim.Framework.Communications.Caches
90 return base2; 90 return base2;
91 } 91 }
92 92
93 public bool DeleteItem(LLUUID itemID)
94 {
95 bool found = false;
96 if (this.Items.ContainsKey(itemID))
97 {
98 Items.Remove(itemID);
99 return true;
100 }
101 foreach (InventoryFolder folder in this.SubFolders.Values)
102 {
103 found = folder.DeleteItem(itemID);
104 if (found == true)
105 {
106 break;
107 }
108 }
109 return found;
110 }
111
112
93 public InventoryFolder HasSubFolder(LLUUID folderID) 113 public InventoryFolder HasSubFolder(LLUUID folderID)
94 { 114 {
95 InventoryFolder returnFolder = null; 115 InventoryFolder returnFolder = null;
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 6f01cf2..bd58756 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -16,5 +16,6 @@ namespace OpenSim.Framework.Communications
16 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 16 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
17 void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); 17 void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
18 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 18 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
19 void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
19 } 20 }
20} 21}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index d8bfc4d..b02aa93 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -320,6 +320,15 @@ namespace OpenSim.Framework.Data.MySQL
320 } 320 }
321 321
322 /// <summary> 322 /// <summary>
323 ///
324 /// </summary>
325 /// <param name="item"></param>
326 public void deleteInventoryItem(InventoryItemBase item)
327 {
328
329 }
330
331 /// <summary>
323 /// Creates a new inventory folder 332 /// Creates a new inventory folder
324 /// </summary> 333 /// </summary>
325 /// <param name="folder">Folder to create</param> 334 /// <param name="folder">Folder to create</param>
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index 045fbee..fe494fb 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -447,6 +447,23 @@ namespace OpenSim.Framework.Data.SQLite
447 } 447 }
448 448
449 /// <summary> 449 /// <summary>
450 ///
451 /// </summary>
452 /// <param name="item"></param>
453 public void deleteInventoryItem(InventoryItemBase item)
454 {
455 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
456
457 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID);
458 if (inventoryRow != null)
459 {
460 inventoryRow.Delete();
461 }
462
463 this.invItemsDa.Update(ds, "inventoryitems");
464 }
465
466 /// <summary>
450 /// Adds a new folder specified by folder 467 /// Adds a new folder specified by folder
451 /// </summary> 468 /// </summary>
452 /// <param name="folder">The inventory folder</param> 469 /// <param name="folder">The inventory folder</param>
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index a12b87b..38c251c 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -202,6 +202,12 @@ namespace OpenSim.Framework.Data
202 void updateInventoryItem(InventoryItemBase item); 202 void updateInventoryItem(InventoryItemBase item);
203 203
204 /// <summary> 204 /// <summary>
205 ///
206 /// </summary>
207 /// <param name="item"></param>
208 void deleteInventoryItem(InventoryItemBase item);
209
210 /// <summary>
205 /// Adds a new folder specified by folder 211 /// Adds a new folder specified by folder
206 /// </summary> 212 /// </summary>
207 /// <param name="folder">The inventory folder</param> 213 /// <param name="folder">The inventory folder</param>
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index f39d0c7..8db1e15 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Interfaces
36{ 36{
37 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 37 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list 38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list
39 public delegate void RezObject(AssetBase primAsset, LLVector3 pos); 39 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); 40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
41 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 41 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
42 public delegate void StartAnim(LLUUID animID, int seq); 42 public delegate void StartAnim(LLUUID animID, int seq);
@@ -210,6 +210,7 @@ namespace OpenSim.Framework.Interfaces
210 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); 210 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
211 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); 211 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
212 void SendInventoryItemUpdate(InventoryItemBase Item); 212 void SendInventoryItemUpdate(InventoryItemBase Item);
213 void SendRemoveInventoryItem(LLUUID itemID);
213 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); 214 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
214 215
215 void SendNameReply(LLUUID profileId, string firstname, string lastname); 216 void SendNameReply(LLUUID profileId, string firstname, string lastname);
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index e85b88f..6be2563 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -138,6 +138,7 @@ namespace OpenSim.Framework
138 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} 138 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
139 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){} 139 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){}
140 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } 140 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
141 public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
141 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } 142 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
142 143
143 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} 144 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
index bc55d05..20d3a77 100644
--- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
+++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
@@ -124,6 +124,14 @@ namespace OpenSim.Framework.InventoryServiceBase
124 } 124 }
125 } 125 }
126 126
127 public void deleteItem(InventoryItemBase item)
128 {
129 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
130 {
131 plugin.Value.deleteInventoryItem(item);
132 }
133 }
134
127 /// <summary> 135 /// <summary>
128 /// 136 ///
129 /// </summary> 137 /// </summary>
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index d7962dc..f655674 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -630,6 +630,18 @@ namespace OpenSim.Region.ClientStack
630 OutPacket(InventoryReply); 630 OutPacket(InventoryReply);
631 } 631 }
632 632
633 public void SendRemoveInventoryItem(LLUUID itemID)
634 {
635 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
636 remove.AgentData.AgentID = this.AgentID;
637 remove.AgentData.SessionID = this.SessionID;
638 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
639 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
640 remove.InventoryData[0].ItemID = itemID;
641
642 OutPacket(remove);
643 }
644
633 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) 645 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
634 { 646 {
635 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); 647 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index f380c25..89df290 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -45,12 +45,12 @@ namespace OpenSim.Region.ClientStack
45 get { return m_moneyBalance; } 45 get { return m_moneyBalance; }
46 } 46 }
47 47
48 public bool AddMoney( int debit ) 48 public bool AddMoney(int debit)
49 { 49 {
50 if( m_moneyBalance + debit >= 0 ) 50 if (m_moneyBalance + debit >= 0)
51 { 51 {
52 m_moneyBalance += debit; 52 m_moneyBalance += debit;
53 SendMoneyBalance( LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance ); 53 SendMoneyBalance(LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance);
54 return true; 54 return true;
55 } 55 }
56 else 56 else
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack
58 return false; 58 return false;
59 } 59 }
60 } 60 }
61 61
62 protected override void ProcessInPacket(Packet Pack) 62 protected override void ProcessInPacket(Packet Pack)
63 { 63 {
64 ack_pack(Pack); 64 ack_pack(Pack);
@@ -126,21 +126,9 @@ namespace OpenSim.Region.ClientStack
126 break; 126 break;
127 case PacketType.RezObject: 127 case PacketType.RezObject:
128 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 128 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
129 AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); 129 if (OnRezObject != null)
130 if (inven != null)
131 { 130 {
132 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) 131 this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd);
133 {
134 AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
135 if (asset != null)
136 {
137 if (OnRezObject != null)
138 {
139 this.OnRezObject(asset, rezPacket.RezData.RayEnd);
140 this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID);
141 }
142 }
143 }
144 } 132 }
145 break; 133 break;
146 case PacketType.DeRezObject: 134 case PacketType.DeRezObject:
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 8295cfa..af58d33 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -63,5 +63,10 @@ namespace OpenSim.Region.Communications.Local
63 { 63 {
64 this.AddItem(item); 64 this.AddItem(item);
65 } 65 }
66
67 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
68 {
69 this.deleteItem(item);
70 }
66 } 71 }
67} 72}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index a98684e..70ab75e 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -29,5 +29,10 @@ namespace OpenSim.Region.Communications.OGS1
29 { 29 {
30 30
31 } 31 }
32
33 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
34 {
35
36 }
32 } 37 }
33} 38}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 10bdd54..b901d23 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches; 35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Utilities;
37 38
38namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
39{ 40{
@@ -209,23 +210,13 @@ namespace OpenSim.Region.Environment.Scenes
209 /// <summary> 210 /// <summary>
210 /// 211 ///
211 /// </summary> 212 /// </summary>
212 /// <param name="primAsset"></param>
213 /// <param name="pos"></param>
214 public void RezObject(AssetBase primAsset, LLVector3 pos)
215 {
216
217 }
218
219 /// <summary>
220 ///
221 /// </summary>
222 /// <param name="packet"></param> 213 /// <param name="packet"></param>
223 /// <param name="simClient"></param> 214 /// <param name="simClient"></param>
224 public void DeRezObject(Packet packet, IClientAPI simClient) 215 public void DeRezObject(Packet packet, IClientAPI remoteClient)
225 { 216 {
226 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 217 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
227 218
228 219
229 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 220 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
230 { 221 {
231 //currently following code not used (or don't know of any case of destination being zero 222 //currently following code not used (or don't know of any case of destination being zero
@@ -246,17 +237,76 @@ namespace OpenSim.Region.Environment.Scenes
246 } 237 }
247 if (selectedEnt != null) 238 if (selectedEnt != null)
248 { 239 {
249 if (PermissionsMngr.CanDeRezObject(simClient.AgentId, selectedEnt.m_uuid)) 240 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId,((SceneObjectGroup)selectedEnt).UUID))
250 { 241 {
251 List<ScenePresence> avatars = this.RequestAvatarList(); 242 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString();
252 foreach (ScenePresence avatar in avatars) 243 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
244 if (userInfo != null)
253 { 245 {
254 avatar.ControllingClient.SendKillObject(this.m_regionHandle, selectedEnt.LocalId); 246 AssetBase asset = new AssetBase();
247 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
248 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
249 asset.InvType = 6;
250 asset.Type = 6;
251 asset.FullID = LLUUID.Random();
252 asset.Data = Helpers.StringToField(sceneObjectXml);
253 this.assetCache.AddAsset(asset);
254
255
256 InventoryItemBase item = new InventoryItemBase();
257 item.avatarID = remoteClient.AgentId;
258 item.creatorsID = remoteClient.AgentId;
259 item.inventoryID = LLUUID.Random();
260 item.assetID = asset.FullID;
261 item.inventoryDescription = asset.Description;
262 item.inventoryName = asset.Name;
263 item.assetType = asset.Type;
264 item.invType = asset.InvType;
265 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
266 item.inventoryCurrentPermissions = 2147483647;
267 item.inventoryNextPermissions = 2147483647;
268
269 userInfo.AddItem(remoteClient.AgentId, item);
270 remoteClient.SendInventoryItemUpdate(item);
255 } 271 }
256 272
273 ((SceneObjectGroup)selectedEnt).DeleteGroup();
274
257 lock (Entities) 275 lock (Entities)
258 { 276 {
259 Entities.Remove(selectedEnt.m_uuid); 277 Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
278 }
279 }
280 }
281 }
282 }
283 }
284
285 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
286 {
287 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
288 if (userInfo != null)
289 {
290 if(userInfo.RootFolder != null)
291 {
292 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
293 if (item != null)
294 {
295 AssetBase rezAsset = this.assetCache.GetAsset(item.assetID, false);
296 if (rezAsset != null)
297 {
298 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
299 userInfo.DeleteItem(remoteClient.AgentId, item);
300 remoteClient.SendRemoveInventoryItem(itemID);
301 }
302 else
303 {
304 rezAsset = this.assetCache.GetAsset(item.assetID, false);
305 if (rezAsset != null)
306 {
307 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
308 userInfo.DeleteItem(remoteClient.AgentId, item);
309 remoteClient.SendRemoveInventoryItem(itemID);
260 } 310 }
261 } 311 }
262 } 312 }
@@ -264,6 +314,13 @@ namespace OpenSim.Region.Environment.Scenes
264 } 314 }
265 } 315 }
266 316
317 private void AddRezObject(string xmlData, LLVector3 pos)
318 {
319 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
320 this.AddEntity(group);
321 group.Pos = pos;
322 }
323
267 /// <summary> 324 /// <summary>
268 /// 325 ///
269 /// </summary> 326 /// </summary>
@@ -301,11 +358,11 @@ namespace OpenSim.Region.Environment.Scenes
301 this.Entities.Add(copy.UUID, copy); 358 this.Entities.Add(copy.UUID, copy);
302 359
303 copy.ScheduleGroupForFullUpdate(); 360 copy.ScheduleGroupForFullUpdate();
304 /* List<ScenePresence> avatars = this.RequestAvatarList(); 361 /* List<ScenePresence> avatars = this.RequestAvatarList();
305 for (int i = 0; i < avatars.Count; i++) 362 for (int i = 0; i < avatars.Count; i++)
306 { 363 {
307 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); 364 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
308 }*/ 365 }*/
309 366
310 } 367 }
311 else 368 else
@@ -620,7 +677,7 @@ namespace OpenSim.Region.Environment.Scenes
620 if (hasPrim != false) 677 if (hasPrim != false)
621 { 678 {
622 ((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot); 679 ((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot);
623 // prim.UpdateGroupMouseRotation(pos, rot); 680 // prim.UpdateGroupMouseRotation(pos, rot);
624 break; 681 break;
625 } 682 }
626 } 683 }
@@ -665,7 +722,7 @@ namespace OpenSim.Region.Environment.Scenes
665 { 722 {
666 if (ent is SceneObjectGroup) 723 if (ent is SceneObjectGroup)
667 { 724 {
668 // prim = ((SceneObject)ent).HasChildPrim(localID); 725 // prim = ((SceneObject)ent).HasChildPrim(localID);
669 if (prim != null) 726 if (prim != null)
670 { 727 {
671 prim.UpdateSingleRotation(rot); 728 prim.UpdateSingleRotation(rot);
@@ -692,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes
692 if (hasPrim != false) 749 if (hasPrim != false)
693 { 750 {
694 ((SceneObjectGroup)ent).Resize(scale, localID); 751 ((SceneObjectGroup)ent).Resize(scale, localID);
695 // prim.ResizeGoup(scale); 752 // prim.ResizeGoup(scale);
696 break; 753 break;
697 } 754 }
698 } 755 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 378acf9..96bb97a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -538,7 +538,10 @@ namespace OpenSim.Region.Environment.Scenes
538 538
539 public void AddEntity(SceneObjectGroup sceneObject) 539 public void AddEntity(SceneObjectGroup sceneObject)
540 { 540 {
541 Entities.Add(sceneObject.UUID, sceneObject); 541 if(!Entities.ContainsKey(sceneObject.UUID))
542 {
543 Entities.Add(sceneObject.UUID, sceneObject);
544 }
542 } 545 }
543 546
544 public void RemoveEntity(SceneObjectGroup sceneObject) 547 public void RemoveEntity(SceneObjectGroup sceneObject)
@@ -604,6 +607,7 @@ namespace OpenSim.Region.Environment.Scenes
604 client.OnObjectDeselect += DeselectPrim; 607 client.OnObjectDeselect += DeselectPrim;
605 client.OnGrabUpdate += MoveObject; 608 client.OnGrabUpdate += MoveObject;
606 client.OnDeRezObject += DeRezObject; 609 client.OnDeRezObject += DeRezObject;
610 client.OnRezObject += RezObject;
607 client.OnNameFromUUIDRequest += commsManager.HandleUUIDNameRequest; 611 client.OnNameFromUUIDRequest += commsManager.HandleUUIDNameRequest;
608 client.OnObjectDescription += PrimDescription; 612 client.OnObjectDescription += PrimDescription;
609 client.OnObjectName += PrimName; 613 client.OnObjectName += PrimName;
@@ -1114,7 +1118,7 @@ namespace OpenSim.Region.Environment.Scenes
1114 this.assetCache.AddAsset(asset); 1118 this.assetCache.AddAsset(asset);
1115 1119
1116 item.assetID = asset.FullID; 1120 item.assetID = asset.FullID;
1117 userInfo.updateItem(remoteClient.AgentId, item); 1121 userInfo.UpdateItem(remoteClient.AgentId, item);
1118 1122
1119 // remoteClient.SendInventoryItemUpdate(item); 1123 // remoteClient.SendInventoryItemUpdate(item);
1120 1124
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 77d936d..73f199e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
39 { 39 {
40 get { return m_rootPart.RotationOffset; } 40 get { return m_rootPart.RotationOffset; }
41 } 41 }
42 42
43 43
44 /// <summary> 44 /// <summary>
45 /// 45 ///
@@ -108,6 +108,12 @@ namespace OpenSim.Region.Environment.Scenes
108 get { return m_rootPart.OwnerID; } 108 get { return m_rootPart.OwnerID; }
109 } 109 }
110 110
111 public string Text
112 {
113 get { return m_rootPart.Text; }
114 set { m_rootPart.Text = value; }
115 }
116
111 /// <summary> 117 /// <summary>
112 /// Added because the Parcel code seems to use it 118 /// Added because the Parcel code seems to use it
113 /// but not sure a object should have this 119 /// but not sure a object should have this
@@ -143,19 +149,40 @@ namespace OpenSim.Region.Environment.Scenes
143 149
144 StringReader sr = new StringReader(xmlData); 150 StringReader sr = new StringReader(xmlData);
145 XmlTextReader reader = new XmlTextReader(sr); 151 XmlTextReader reader = new XmlTextReader(sr);
152 reader.Read();
146 reader.ReadStartElement("SceneObjectGroup"); 153 reader.ReadStartElement("SceneObjectGroup");
147 reader.ReadStartElement("RootPart"); 154 reader.ReadStartElement("RootPart");
148 this.m_rootPart = SceneObjectPart.FromXml(reader); 155 this.m_rootPart = SceneObjectPart.FromXml(reader);
149 reader.ReadEndElement(); 156 reader.ReadEndElement();
150 //TODO: read and create rest of the parts 157
151 reader.ReadEndElement(); 158 while (reader.Read())
159 {
160 switch (reader.NodeType)
161 {
162 case XmlNodeType.Element:
163 if (reader.Name == "Part")
164 {
165 reader.Read();
166 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
167 Part.LocalID = m_scene.PrimIDAllocate();
168 this.AddPart(Part);
169 Part.RegionHandle = m_regionHandle;
170 }
171 break;
172 case XmlNodeType.EndElement:
173 break;
174 }
175 }
152 reader.Close(); 176 reader.Close();
153 sr.Close(); 177 sr.Close();
154 178 this.m_rootPart.SetParent(this);
155 this.m_parts.Add(m_rootPart.UUID, m_rootPart); 179 this.m_parts.Add(m_rootPart.UUID, m_rootPart);
156 this.m_rootPart.LocalID = m_scene.PrimIDAllocate(); 180 this.m_rootPart.LocalID = m_scene.PrimIDAllocate();
181 this.m_rootPart.ParentID = 0;
157 this.m_rootPart.RegionHandle = m_regionHandle; 182 this.m_rootPart.RegionHandle = m_regionHandle;
183 this.UpdateParentIDs();
158 m_scene.EventManager.OnBackup += this.ProcessBackup; 184 m_scene.EventManager.OnBackup += this.ProcessBackup;
185 this.ScheduleGroupForFullUpdate();
159 } 186 }
160 187
161 /// <summary> 188 /// <summary>
@@ -192,6 +219,17 @@ namespace OpenSim.Region.Environment.Scenes
192 writer.WriteStartElement(String.Empty, "RootPart", String.Empty); 219 writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
193 m_rootPart.ToXml(writer); 220 m_rootPart.ToXml(writer);
194 writer.WriteEndElement(); 221 writer.WriteEndElement();
222 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
223 foreach (SceneObjectPart part in this.m_parts.Values)
224 {
225 if (part.UUID != this.m_rootPart.UUID)
226 {
227 writer.WriteStartElement(String.Empty, "Part", String.Empty);
228 part.ToXml(writer);
229 writer.WriteEndElement();
230 }
231 }
232 writer.WriteEndElement();
195 writer.WriteEndElement(); 233 writer.WriteEndElement();
196 writer.Close(); 234 writer.Close();
197 // System.Console.WriteLine("prim: " + sw.ToString()); 235 // System.Console.WriteLine("prim: " + sw.ToString());
@@ -215,11 +253,11 @@ namespace OpenSim.Region.Environment.Scenes
215 dupe.m_regionHandle = this.m_regionHandle; 253 dupe.m_regionHandle = this.m_regionHandle;
216 254
217 dupe.CopyRootPart(this.m_rootPart); 255 dupe.CopyRootPart(this.m_rootPart);
218 256
219 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); 257 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values);
220 foreach (SceneObjectPart part in partList) 258 foreach (SceneObjectPart part in partList)
221 { 259 {
222 if (part.UUID != this.m_rootPart.UUID) 260 if (part.UUID != this.m_rootPart.UUID)
223 { 261 {
224 dupe.CopyPart(part); 262 dupe.CopyPart(part);
225 } 263 }
@@ -477,13 +515,6 @@ namespace OpenSim.Region.Environment.Scenes
477 } 515 }
478 } 516 }
479 517
480 public string Text
481 {
482 get { return m_rootPart.Text; }
483 set { m_rootPart.Text = value; }
484 }
485
486
487 public void SetPartText(string text, uint localID) 518 public void SetPartText(string text, uint localID)
488 { 519 {
489 SceneObjectPart part = this.GetChildPrim(localID); 520 SceneObjectPart part = this.GetChildPrim(localID);
@@ -502,6 +533,26 @@ namespace OpenSim.Region.Environment.Scenes
502 } 533 }
503 } 534 }
504 535
536 public string GetPartName(uint localID)
537 {
538 SceneObjectPart part = this.GetChildPrim(localID);
539 if (part != null)
540 {
541 return part.PartName;
542 }
543 return "";
544 }
545
546 public string GetPartDescription(uint localID)
547 {
548 SceneObjectPart part = this.GetChildPrim(localID);
549 if (part != null)
550 {
551 return part.Description;
552 }
553 return "";
554 }
555
505 /// <summary> 556 /// <summary>
506 /// 557 ///
507 /// </summary> 558 /// </summary>
@@ -598,7 +649,7 @@ namespace OpenSim.Region.Environment.Scenes
598 SceneObjectPart part = this.GetChildPrim(localID); 649 SceneObjectPart part = this.GetChildPrim(localID);
599 if (part != null) 650 if (part != null)
600 { 651 {
601 if (part.UUID== this.m_rootPart.UUID) 652 if (part.UUID == this.m_rootPart.UUID)
602 { 653 {
603 this.UpdateRootPosition(pos); 654 this.UpdateRootPosition(pos);
604 } 655 }
@@ -805,14 +856,14 @@ namespace OpenSim.Region.Environment.Scenes
805 856
806 public override void UpdateMovement() 857 public override void UpdateMovement()
807 { 858 {
808 foreach( SceneObjectPart part in m_parts.Values ) 859 foreach (SceneObjectPart part in m_parts.Values)
809 { 860 {
810 part.UpdateMovement(); 861 part.UpdateMovement();
811 } 862 }
812 863
813 base.UpdateMovement(); 864 base.UpdateMovement();
814 } 865 }
815 866
816 /// <summary> 867 /// <summary>
817 /// Added as a way for the storage provider to reset the scene, 868 /// Added as a way for the storage provider to reset the scene,
818 /// most likely a better way to do this sort of thing but for now... 869 /// most likely a better way to do this sort of thing but for now...
@@ -857,8 +908,8 @@ namespace OpenSim.Region.Environment.Scenes
857 } 908 }
858 return null; 909 return null;
859 } 910 }
860 911
861 public void UpdateText( string text ) 912 public void UpdateText(string text)
862 { 913 {
863 m_rootPart.Text = text; 914 m_rootPart.Text = text;
864 m_rootPart.ScheduleTerseUpdate(); 915 m_rootPart.ScheduleTerseUpdate();
@@ -866,7 +917,7 @@ namespace OpenSim.Region.Environment.Scenes
866 917
867 public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient) 918 public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient)
868 { 919 {
869 if( m_rootPart.LocalID == localId ) 920 if (m_rootPart.LocalID == localId)
870 { 921 {
871 OnGrabGroup(offsetPos, remoteClient); 922 OnGrabGroup(offsetPos, remoteClient);
872 } 923 }
@@ -886,5 +937,18 @@ namespace OpenSim.Region.Environment.Scenes
886 { 937 {
887 938
888 } 939 }
940
941 public void DeleteGroup()
942 {
943 m_scene.EventManager.OnBackup -= this.ProcessBackup;
944 foreach (SceneObjectPart part in this.m_parts.Values)
945 {
946 List<ScenePresence> avatars = this.RequestSceneAvatars();
947 for (int i = 0; i < avatars.Count; i++)
948 {
949 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID);
950 }
951 }
952 }
889 } 953 }
890} 954}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 8bd7496..25b62b8 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -153,6 +153,7 @@ namespace SimpleApp
153 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } 153 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
154 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } 154 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { }
155 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } 155 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
156 public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
156 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } 157 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
157 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } 158 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
158 159