diff options
Diffstat (limited to 'OpenSim.RegionServer/Assets')
-rw-r--r-- | OpenSim.RegionServer/Assets/AssetCache.cs | 79 | ||||
-rw-r--r-- | OpenSim.RegionServer/Assets/InventoryCache.cs | 27 |
2 files changed, 57 insertions, 49 deletions
diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs index 4149cb2..c1b3472 100644 --- a/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim.RegionServer/Assets/AssetCache.cs | |||
@@ -123,6 +123,36 @@ namespace OpenSim.Assets | |||
123 | return inventorySet; | 123 | return inventorySet; |
124 | } | 124 | } |
125 | 125 | ||
126 | public AssetBase GetAsset(LLUUID assetID) | ||
127 | { | ||
128 | AssetBase asset = null; | ||
129 | if(this.Textures.ContainsKey(assetID)) | ||
130 | { | ||
131 | asset = this.Textures[assetID]; | ||
132 | } | ||
133 | else if (this.Assets.ContainsKey(assetID)) | ||
134 | { | ||
135 | asset = this.Assets[assetID]; | ||
136 | } | ||
137 | return asset; | ||
138 | } | ||
139 | |||
140 | public void AddAsset(AssetBase asset) | ||
141 | { | ||
142 | this._assetServer.UploadNewAsset(asset); | ||
143 | if (asset.Type == 0) | ||
144 | { | ||
145 | //texture | ||
146 | TextureImage textur = new TextureImage(asset); | ||
147 | this.Textures.Add(textur.FullID, textur); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | AssetInfo assetInf = new AssetInfo(asset); | ||
152 | this.Assets.Add(assetInf.FullID, assetInf); | ||
153 | } | ||
154 | } | ||
155 | |||
126 | /// <summary> | 156 | /// <summary> |
127 | /// | 157 | /// |
128 | /// </summary> | 158 | /// </summary> |
@@ -150,7 +180,7 @@ namespace OpenSim.Assets | |||
150 | req = (AssetRequest)this.TextureRequests[i]; | 180 | req = (AssetRequest)this.TextureRequests[i]; |
151 | if (req.PacketCounter != req.NumPackets) | 181 | if (req.PacketCounter != req.NumPackets) |
152 | { | 182 | { |
153 | 183 | // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) | |
154 | if (req.PacketCounter == 0) | 184 | if (req.PacketCounter == 0) |
155 | { | 185 | { |
156 | //first time for this request so send imagedata packet | 186 | //first time for this request so send imagedata packet |
@@ -186,7 +216,7 @@ namespace OpenSim.Assets | |||
186 | } | 216 | } |
187 | else | 217 | else |
188 | { | 218 | { |
189 | //send imagepacket | 219 | //send imagepacket |
190 | //more than one packet so split file up | 220 | //more than one packet so split file up |
191 | ImagePacketPacket im = new ImagePacketPacket(); | 221 | ImagePacketPacket im = new ImagePacketPacket(); |
192 | im.ImageID.Packet = (ushort)req.PacketCounter; | 222 | im.ImageID.Packet = (ushort)req.PacketCounter; |
@@ -461,7 +491,6 @@ namespace OpenSim.Assets | |||
461 | { | 491 | { |
462 | req.NumPackets = 1; | 492 | req.NumPackets = 1; |
463 | } | 493 | } |
464 | |||
465 | this.TextureRequests.Add(req); | 494 | this.TextureRequests.Add(req); |
466 | } | 495 | } |
467 | 496 | ||
@@ -477,50 +506,6 @@ namespace OpenSim.Assets | |||
477 | } | 506 | } |
478 | #endregion | 507 | #endregion |
479 | 508 | ||
480 | #region viewer asset uploading | ||
481 | public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) | ||
482 | { | ||
483 | |||
484 | AssetBase asset = null; | ||
485 | if (pack.AssetBlock.Type == 0) | ||
486 | { | ||
487 | if (pack.AssetBlock.AssetData.Length > 0) | ||
488 | { | ||
489 | //first packet for transaction | ||
490 | asset = new AssetBase(); | ||
491 | asset.FullID = assetID; | ||
492 | asset.Type = pack.AssetBlock.Type; | ||
493 | asset.InvType = asset.Type; | ||
494 | asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); | ||
495 | asset.Data = pack.AssetBlock.AssetData; | ||
496 | this._assetServer.UploadNewAsset(asset); | ||
497 | TextureImage image = new TextureImage(asset); | ||
498 | this.Textures.Add(image.FullID, image); | ||
499 | } | ||
500 | } | ||
501 | |||
502 | return asset; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | public AssetBase TransactionComplete(LLUUID transactionID) | ||
507 | { | ||
508 | AssetBase asset = null; | ||
509 | if(this.IncomingAssets.ContainsKey(transactionID)) | ||
510 | { | ||
511 | // not the first packet of this transaction | ||
512 | asset = this.IncomingAssets[transactionID]; | ||
513 | if(asset.Type == 0) | ||
514 | { | ||
515 | TextureImage image = new TextureImage(asset); | ||
516 | this.Textures.Add(image.FullID, image); | ||
517 | } | ||
518 | } | ||
519 | return asset; | ||
520 | }*/ | ||
521 | |||
522 | #endregion | ||
523 | |||
524 | } | 509 | } |
525 | 510 | ||
526 | public class AssetRequest | 511 | public class AssetRequest |
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index e4d0a90..9e73fe5 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs | |||
@@ -65,14 +65,20 @@ namespace OpenSim.Assets | |||
65 | } | 65 | } |
66 | 66 | ||
67 | } | 67 | } |
68 | |||
68 | public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) | 69 | public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) |
69 | { | 70 | { |
71 | return this.CreateNewInventoryFolder(remoteClient, folderID, 0); | ||
72 | } | ||
73 | |||
74 | public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type) | ||
75 | { | ||
70 | bool res = false; | 76 | bool res = false; |
71 | if (folderID != LLUUID.Zero) //don't create a folder with a zero id | 77 | if (folderID != LLUUID.Zero) //don't create a folder with a zero id |
72 | { | 78 | { |
73 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | 79 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) |
74 | { | 80 | { |
75 | res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID); | 81 | res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); |
76 | } | 82 | } |
77 | } | 83 | } |
78 | return res; | 84 | return res; |
@@ -94,6 +100,22 @@ namespace OpenSim.Assets | |||
94 | return newItem; | 100 | return newItem; |
95 | } | 101 | } |
96 | 102 | ||
103 | public bool UpdateInventoryItem(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset) | ||
104 | { | ||
105 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
106 | { | ||
107 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItem(itemID, asset); | ||
108 | if (res) | ||
109 | { | ||
110 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; | ||
111 | this.SendItemUpdateCreate(remoteClient, Item); | ||
112 | } | ||
113 | return res; | ||
114 | } | ||
115 | |||
116 | return false; | ||
117 | } | ||
118 | |||
97 | public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) | 119 | public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) |
98 | { | 120 | { |
99 | if (this._agentsInventory.ContainsKey(userInfo.AgentID)) | 121 | if (this._agentsInventory.ContainsKey(userInfo.AgentID)) |
@@ -190,6 +212,7 @@ namespace OpenSim.Assets | |||
190 | } | 212 | } |
191 | } | 213 | } |
192 | } | 214 | } |
215 | |||
193 | private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) | 216 | private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) |
194 | { | 217 | { |
195 | 218 | ||
@@ -223,7 +246,7 @@ namespace OpenSim.Assets | |||
223 | } | 246 | } |
224 | } | 247 | } |
225 | 248 | ||
226 | 249 | ||
227 | 250 | ||
228 | public class UserServerRequest | 251 | public class UserServerRequest |
229 | { | 252 | { |