diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | 545 | ||||
-rw-r--r-- | OpenSim/Framework/Culture.cs | 67 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryCollection.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/LLSDxmlEncode.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 130 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 1 |
6 files changed, 217 insertions, 545 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index 427a310..2a25d9c 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers | |||
64 | public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 64 | public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
65 | { | 65 | { |
66 | //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request); | 66 | //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request); |
67 | 67 | ||
68 | Hashtable hash = new Hashtable(); | 68 | Hashtable hash = new Hashtable(); |
69 | try | 69 | try |
70 | { | 70 | { |
@@ -77,12 +77,12 @@ namespace OpenSim.Capabilities.Handlers | |||
77 | } | 77 | } |
78 | 78 | ||
79 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | 79 | ArrayList foldersrequested = (ArrayList)hash["folders"]; |
80 | hash.Clear(); | ||
80 | 81 | ||
81 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); | 82 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); |
82 | for (int i = 0; i < foldersrequested.Count; i++) | 83 | for (int i = 0; i < foldersrequested.Count; i++) |
83 | { | 84 | { |
84 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | 85 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; |
85 | |||
86 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | 86 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); |
87 | 87 | ||
88 | try | 88 | try |
@@ -98,37 +98,90 @@ namespace OpenSim.Capabilities.Handlers | |||
98 | folders.Add(llsdRequest); | 98 | folders.Add(llsdRequest); |
99 | } | 99 | } |
100 | 100 | ||
101 | foldersrequested.Clear(); | ||
102 | |||
101 | if(folders.Count == 0) | 103 | if(folders.Count == 0) |
102 | return "<llsd><map><key>folders</key><array /></map></llsd>"; | 104 | return "<llsd><map><key>folders</key><array /></map></llsd>"; |
103 | 105 | ||
104 | List<UUID> bad_folders = new List<UUID>(); | 106 | List<UUID> bad_folders = new List<UUID>(); |
105 | 107 | ||
106 | List<InventoryCollectionWithDescendents> invcollSet = Fetch(folders, bad_folders); | 108 | int total_folders = 0; |
109 | int total_items = 0; | ||
110 | List<InventoryCollection> invcollSet = Fetch(folders, bad_folders, ref total_folders, ref total_items); | ||
107 | //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count); | 111 | //m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count); |
108 | 112 | ||
109 | if (invcollSet == null) | 113 | int invcollSetCount = invcollSet.Count; |
110 | { | ||
111 | m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Multiple folder fetch failed. Trying old protocol."); | ||
112 | #pragma warning disable 0612 | ||
113 | return FetchInventoryDescendentsRequest(foldersrequested, httpRequest, httpResponse); | ||
114 | #pragma warning restore 0612 | ||
115 | } | ||
116 | 114 | ||
117 | StringBuilder lastresponse = new StringBuilder(1024); | 115 | int mem = 8192 + ((256 * invcollSetCount + |
116 | 384 * total_folders + | ||
117 | 1024 * total_items + | ||
118 | 128 * bad_folders.Count) & 0x7ffff000); | ||
119 | |||
120 | StringBuilder lastresponse = new StringBuilder(mem); | ||
118 | lastresponse.Append("<llsd>"); | 121 | lastresponse.Append("<llsd>"); |
119 | 122 | ||
120 | if(invcollSet.Count > 0) | 123 | if(invcollSetCount > 0) |
121 | { | 124 | { |
122 | lastresponse.Append("<map><key>folders</key><array>"); | 125 | lastresponse.Append("<map><key>folders</key><array>"); |
123 | foreach (InventoryCollectionWithDescendents icoll in invcollSet) | 126 | int i = 0; |
127 | InventoryCollection thiscoll; | ||
128 | for(i = 0; i < invcollSetCount; i++) | ||
124 | { | 129 | { |
125 | LLSDInventoryFolderContents thiscontents = contentsToLLSD(icoll.Collection, icoll.Descendents); | 130 | thiscoll = invcollSet[i]; |
126 | lastresponse.Append(LLSDHelpers.SerialiseLLSDReplyNoHeader(thiscontents)); | 131 | invcollSet[i] = null; |
132 | |||
133 | LLSDxmlEncode.AddMap(lastresponse); | ||
134 | LLSDxmlEncode.AddElem("agent_id", thiscoll.OwnerID, lastresponse); | ||
135 | LLSDxmlEncode.AddElem("descendents", thiscoll.Descendents, lastresponse); | ||
136 | LLSDxmlEncode.AddElem("folder_id", thiscoll.FolderID, lastresponse); | ||
137 | |||
138 | if(thiscoll.Folders == null || thiscoll.Folders.Count == 0) | ||
139 | LLSDxmlEncode.AddEmptyArray("categories", lastresponse); | ||
140 | else | ||
141 | { | ||
142 | LLSDxmlEncode.AddArray("categories", lastresponse); | ||
143 | foreach (InventoryFolderBase invFolder in thiscoll.Folders) | ||
144 | { | ||
145 | LLSDxmlEncode.AddMap(lastresponse); | ||
146 | |||
147 | LLSDxmlEncode.AddElem("folder_id", invFolder.ID, lastresponse); | ||
148 | LLSDxmlEncode.AddElem("parent_id", invFolder.ParentID, lastresponse); | ||
149 | LLSDxmlEncode.AddElem("name", invFolder.Name, lastresponse); | ||
150 | LLSDxmlEncode.AddElem("type", invFolder.Type, lastresponse); | ||
151 | LLSDxmlEncode.AddElem("preferred_type", (int)-1, lastresponse); | ||
152 | LLSDxmlEncode.AddElem("version", invFolder.Version, lastresponse); | ||
153 | |||
154 | LLSDxmlEncode.AddEndMap(lastresponse); | ||
155 | } | ||
156 | LLSDxmlEncode.AddEndArray(lastresponse); | ||
157 | } | ||
158 | |||
159 | if(thiscoll.Items == null || thiscoll.Items.Count == 0) | ||
160 | LLSDxmlEncode.AddEmptyArray("items", lastresponse); | ||
161 | else | ||
162 | { | ||
163 | LLSDxmlEncode.AddArray("items", lastresponse); | ||
164 | foreach (InventoryItemBase invItem in thiscoll.Items) | ||
165 | { | ||
166 | invItem.ToLLSDxml(lastresponse); | ||
167 | } | ||
168 | |||
169 | LLSDxmlEncode.AddEndArray(lastresponse); | ||
170 | } | ||
171 | |||
172 | LLSDxmlEncode.AddElem("owner_id", thiscoll.OwnerID, lastresponse); | ||
173 | LLSDxmlEncode.AddElem("version", thiscoll.Version, lastresponse); | ||
174 | |||
175 | LLSDxmlEncode.AddEndMap(lastresponse); | ||
176 | invcollSet[i] = null; | ||
127 | } | 177 | } |
128 | lastresponse.Append("</array></map>"); | 178 | lastresponse.Append("</array></map>"); |
179 | thiscoll = null; | ||
129 | } | 180 | } |
130 | else | 181 | else |
182 | { | ||
131 | lastresponse.Append("<map><key>folders</key><array /></map>"); | 183 | lastresponse.Append("<map><key>folders</key><array /></map>"); |
184 | } | ||
132 | 185 | ||
133 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); | 186 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); |
134 | if(bad_folders.Count > 0) | 187 | if(bad_folders.Count > 0) |
@@ -144,298 +197,47 @@ namespace OpenSim.Capabilities.Handlers | |||
144 | } | 197 | } |
145 | lastresponse.Append("</llsd>"); | 198 | lastresponse.Append("</llsd>"); |
146 | 199 | ||
147 | return lastresponse.ToString();; | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Construct an LLSD reply packet to a CAPS inventory request | ||
152 | /// </summary> | ||
153 | /// <param name="invFetch"></param> | ||
154 | /// <returns></returns> | ||
155 | private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch) | ||
156 | { | ||
157 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | ||
158 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | ||
159 | contents.agent_id = invFetch.owner_id; | ||
160 | contents.owner_id = invFetch.owner_id; | ||
161 | contents.folder_id = invFetch.folder_id; | ||
162 | |||
163 | reply.folders.Array.Add(contents); | ||
164 | InventoryCollection inv = new InventoryCollection(); | ||
165 | inv.Folders = new List<InventoryFolderBase>(); | ||
166 | inv.Items = new List<InventoryItemBase>(); | ||
167 | int version = 0; | ||
168 | int descendents = 0; | ||
169 | |||
170 | #pragma warning disable 0612 | ||
171 | inv = Fetch( | ||
172 | invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, | ||
173 | invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents); | ||
174 | #pragma warning restore 0612 | ||
175 | |||
176 | if (inv != null && inv.Folders != null) | ||
177 | { | ||
178 | foreach (InventoryFolderBase invFolder in inv.Folders) | ||
179 | { | ||
180 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | ||
181 | } | ||
182 | |||
183 | descendents += inv.Folders.Count; | ||
184 | } | ||
185 | |||
186 | if (inv != null && inv.Items != null) | ||
187 | { | ||
188 | foreach (InventoryItemBase invItem in inv.Items) | ||
189 | { | ||
190 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
191 | } | ||
192 | } | ||
193 | |||
194 | contents.descendents = descendents; | ||
195 | contents.version = version; | ||
196 | |||
197 | //m_log.DebugFormat( | ||
198 | // "[WEB FETCH INV DESC HANDLER]: Replying to request for folder {0} (fetch items {1}, fetch folders {2}) with {3} items and {4} folders for agent {5}", | ||
199 | // invFetch.folder_id, | ||
200 | // invFetch.fetch_items, | ||
201 | // invFetch.fetch_folders, | ||
202 | // contents.items.Array.Count, | ||
203 | // contents.categories.Array.Count, | ||
204 | // invFetch.owner_id); | ||
205 | |||
206 | return reply; | ||
207 | } | ||
208 | |||
209 | private LLSDInventoryFolderContents contentsToLLSD(InventoryCollection inv, int descendents) | ||
210 | { | ||
211 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | ||
212 | contents.agent_id = inv.OwnerID; | ||
213 | contents.owner_id = inv.OwnerID; | ||
214 | contents.folder_id = inv.FolderID; | ||
215 | |||
216 | if (inv.Folders != null) | ||
217 | { | ||
218 | foreach (InventoryFolderBase invFolder in inv.Folders) | ||
219 | { | ||
220 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | if (inv.Items != null) | ||
225 | { | ||
226 | foreach (InventoryItemBase invItem in inv.Items) | ||
227 | { | ||
228 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | contents.descendents = descendents; | ||
233 | contents.version = inv.Version; | ||
234 | |||
235 | return contents; | ||
236 | } | ||
237 | /// <summary> | ||
238 | /// Old style. Soon to be deprecated. | ||
239 | /// </summary> | ||
240 | /// <param name="request"></param> | ||
241 | /// <param name="httpRequest"></param> | ||
242 | /// <param name="httpResponse"></param> | ||
243 | /// <returns></returns> | ||
244 | [Obsolete] | ||
245 | private string FetchInventoryDescendentsRequest(ArrayList foldersrequested, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
246 | { | ||
247 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count); | ||
248 | |||
249 | StringBuilder tmpresponse = new StringBuilder(1024); | ||
250 | StringBuilder tmpbadfolders = new StringBuilder(1024); | ||
251 | |||
252 | for (int i = 0; i < foldersrequested.Count; i++) | ||
253 | { | ||
254 | string inventoryitemstr = ""; | ||
255 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
256 | |||
257 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
258 | |||
259 | try | ||
260 | { | ||
261 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
262 | } | ||
263 | catch (Exception e) | ||
264 | { | ||
265 | m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e); | ||
266 | } | ||
267 | |||
268 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
269 | |||
270 | if (null == reply) | ||
271 | { | ||
272 | tmpbadfolders.Append("<map><key>folder_id</key><uuid>"); | ||
273 | tmpbadfolders.Append(llsdRequest.folder_id.ToString()); | ||
274 | tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>"); | ||
275 | } | ||
276 | else | ||
277 | { | ||
278 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
279 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
280 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
281 | } | ||
282 | |||
283 | tmpresponse.Append(inventoryitemstr); | ||
284 | } | ||
285 | |||
286 | StringBuilder lastresponse = new StringBuilder(1024); | ||
287 | lastresponse.Append("<llsd>"); | ||
288 | if(tmpresponse.Length > 0) | ||
289 | { | ||
290 | lastresponse.Append("<map><key>folders</key><array>"); | ||
291 | lastresponse.Append(tmpresponse.ToString()); | ||
292 | lastresponse.Append("</array></map>"); | ||
293 | } | ||
294 | else | ||
295 | lastresponse.Append("<map><key>folders</key><array /></map>"); | ||
296 | |||
297 | if(tmpbadfolders.Length > 0) | ||
298 | { | ||
299 | lastresponse.Append("<map><key>bad_folders</key><array>"); | ||
300 | lastresponse.Append(tmpbadfolders.ToString()); | ||
301 | lastresponse.Append("</array></map>"); | ||
302 | } | ||
303 | lastresponse.Append("</llsd>"); | ||
304 | |||
305 | return lastresponse.ToString(); | 200 | return lastresponse.ToString(); |
306 | } | 201 | } |
307 | 202 | ||
308 | /// <summary> | 203 | private void AddLibraryFolders(List<LLSDFetchInventoryDescendents> libFolders, List<InventoryCollection> result, ref int total_folders, ref int total_items) |
309 | /// Handle the caps inventory descendents fetch. | ||
310 | /// </summary> | ||
311 | /// <param name="agentID"></param> | ||
312 | /// <param name="folderID"></param> | ||
313 | /// <param name="ownerID"></param> | ||
314 | /// <param name="fetchFolders"></param> | ||
315 | /// <param name="fetchItems"></param> | ||
316 | /// <param name="sortOrder"></param> | ||
317 | /// <param name="version"></param> | ||
318 | /// <returns>An empty InventoryCollection if the inventory look up failed</returns> | ||
319 | [Obsolete] | ||
320 | private InventoryCollection Fetch( | ||
321 | UUID agentID, UUID folderID, UUID ownerID, | ||
322 | bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents) | ||
323 | { | ||
324 | //m_log.DebugFormat( | ||
325 | // "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | ||
326 | // fetchFolders, fetchItems, folderID, agentID); | ||
327 | |||
328 | // FIXME MAYBE: We're not handling sortOrder! | ||
329 | |||
330 | version = 0; | ||
331 | descendents = 0; | ||
332 | |||
333 | InventoryFolderImpl fold; | ||
334 | if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) | ||
335 | { | ||
336 | if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) | ||
337 | { | ||
338 | InventoryCollection ret = new InventoryCollection(); | ||
339 | ret.Folders = new List<InventoryFolderBase>(); | ||
340 | ret.Items = fold.RequestListOfItems(); | ||
341 | descendents = ret.Folders.Count + ret.Items.Count; | ||
342 | |||
343 | return ret; | ||
344 | } | ||
345 | } | ||
346 | |||
347 | InventoryCollection contents = new InventoryCollection(); | ||
348 | |||
349 | if (folderID != UUID.Zero) | ||
350 | { | ||
351 | InventoryCollection fetchedContents = m_InventoryService.GetFolderContent(agentID, folderID); | ||
352 | |||
353 | if (fetchedContents == null) | ||
354 | { | ||
355 | m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Could not get contents of folder {0} for user {1}", folderID, agentID); | ||
356 | return contents; | ||
357 | } | ||
358 | contents = fetchedContents; | ||
359 | InventoryFolderBase containingFolder = m_InventoryService.GetFolder(agentID, folderID); | ||
360 | |||
361 | if (containingFolder != null) | ||
362 | { | ||
363 | //m_log.DebugFormat( | ||
364 | // "[WEB FETCH INV DESC HANDLER]: Retrieved folder {0} {1} for agent id {2}", | ||
365 | // containingFolder.Name, containingFolder.ID, agentID); | ||
366 | |||
367 | version = containingFolder.Version; | ||
368 | |||
369 | if (fetchItems && containingFolder.Type != (short)FolderType.Trash) | ||
370 | { | ||
371 | List<InventoryItemBase> itemsToReturn = contents.Items; | ||
372 | List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn); | ||
373 | |||
374 | // descendents must only include the links, not the linked items we add | ||
375 | descendents = originalItems.Count; | ||
376 | |||
377 | // Add target items for links in this folder before the links themselves. | ||
378 | foreach (InventoryItemBase item in originalItems) | ||
379 | { | ||
380 | if (item.AssetType == (int)AssetType.Link) | ||
381 | { | ||
382 | InventoryItemBase linkedItem = m_InventoryService.GetItem(agentID, item.AssetID); | ||
383 | |||
384 | // Take care of genuinely broken links where the target doesn't exist | ||
385 | // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, | ||
386 | // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles | ||
387 | // rather than having to keep track of every folder requested in the recursion. | ||
388 | if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) | ||
389 | itemsToReturn.Insert(0, linkedItem); | ||
390 | } | ||
391 | } | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | // Lost items don't really need a version | ||
398 | version = 1; | ||
399 | } | ||
400 | |||
401 | return contents; | ||
402 | |||
403 | } | ||
404 | |||
405 | private void AddLibraryFolders(List<LLSDFetchInventoryDescendents> libFolders, List<InventoryCollectionWithDescendents> result) | ||
406 | { | 204 | { |
407 | InventoryFolderImpl fold; | 205 | InventoryFolderImpl fold; |
206 | if (m_LibraryService == null || m_LibraryService.LibraryRootFolder == null) | ||
207 | return; | ||
208 | |||
408 | foreach (LLSDFetchInventoryDescendents f in libFolders) | 209 | foreach (LLSDFetchInventoryDescendents f in libFolders) |
409 | { | 210 | { |
410 | if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(f.folder_id)) != null) | 211 | if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(f.folder_id)) != null) |
411 | { | 212 | { |
412 | InventoryCollectionWithDescendents ret = new InventoryCollectionWithDescendents(); | 213 | InventoryCollection Collection = new InventoryCollection(); |
413 | ret.Collection = new InventoryCollection(); | ||
414 | // ret.Collection.Folders = new List<InventoryFolderBase>(); | 214 | // ret.Collection.Folders = new List<InventoryFolderBase>(); |
415 | ret.Collection.Folders = fold.RequestListOfFolders(); | 215 | Collection.Folders = fold.RequestListOfFolders(); |
416 | ret.Collection.Items = fold.RequestListOfItems(); | 216 | Collection.Items = fold.RequestListOfItems(); |
417 | ret.Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner; | 217 | Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner; |
418 | ret.Collection.FolderID = f.folder_id; | 218 | Collection.FolderID = f.folder_id; |
419 | ret.Collection.Version = fold.Version; | 219 | Collection.Version = fold.Version; |
420 | 220 | ||
421 | ret.Descendents = ret.Collection.Items.Count + ret.Collection.Folders.Count; | 221 | Collection.Descendents = Collection.Items.Count + Collection.Folders.Count; |
422 | result.Add(ret); | 222 | total_folders += Collection.Folders.Count; |
223 | total_items += Collection.Items.Count; | ||
224 | result.Add(Collection); | ||
423 | 225 | ||
424 | //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID); | 226 | //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID); |
425 | } | 227 | } |
426 | } | 228 | } |
427 | } | 229 | } |
428 | 230 | ||
429 | private List<InventoryCollectionWithDescendents> Fetch(List<LLSDFetchInventoryDescendents> fetchFolders, List<UUID> bad_folders) | 231 | private List<InventoryCollection> Fetch(List<LLSDFetchInventoryDescendents> fetchFolders, List<UUID> bad_folders, ref int total_folders, ref int total_items) |
430 | { | 232 | { |
431 | //m_log.DebugFormat( | 233 | //m_log.DebugFormat( |
432 | // "[WEB FETCH INV DESC HANDLER]: Fetching {0} folders for owner {1}", fetchFolders.Count, fetchFolders[0].owner_id); | 234 | // "[WEB FETCH INV DESC HANDLER]: Fetching {0} folders for owner {1}", fetchFolders.Count, fetchFolders[0].owner_id); |
433 | 235 | ||
434 | // FIXME MAYBE: We're not handling sortOrder! | 236 | // FIXME MAYBE: We're not handling sortOrder! |
435 | 237 | ||
436 | List<InventoryCollectionWithDescendents> result = new List<InventoryCollectionWithDescendents>(); | 238 | List<InventoryCollection> result = new List<InventoryCollection>(32); |
437 | List<LLSDFetchInventoryDescendents> libFolders = new List<LLSDFetchInventoryDescendents>(); | 239 | List<LLSDFetchInventoryDescendents> libFolders = new List<LLSDFetchInventoryDescendents>(32); |
438 | List<LLSDFetchInventoryDescendents> otherFolders = new List<LLSDFetchInventoryDescendents>(); | 240 | List<LLSDFetchInventoryDescendents> otherFolders = new List<LLSDFetchInventoryDescendents>(32); |
439 | HashSet<UUID> libIDs = new HashSet<UUID>(); | 241 | HashSet<UUID> libIDs = new HashSet<UUID>(); |
440 | HashSet<UUID> otherIDs = new HashSet<UUID>(); | 242 | HashSet<UUID> otherIDs = new HashSet<UUID>(); |
441 | 243 | ||
@@ -455,13 +257,12 @@ namespace OpenSim.Capabilities.Handlers | |||
455 | if(doneZeroID) | 257 | if(doneZeroID) |
456 | continue; | 258 | continue; |
457 | doneZeroID = true; | 259 | doneZeroID = true; |
458 | InventoryCollectionWithDescendents zeroColl = new InventoryCollectionWithDescendents(); | 260 | InventoryCollection Collection = new InventoryCollection(); |
459 | zeroColl.Collection = new InventoryCollection(); | 261 | Collection.OwnerID = f.owner_id; |
460 | zeroColl.Collection.OwnerID = f.owner_id; | 262 | Collection.Version = 0; |
461 | zeroColl.Collection.Version = 0; | 263 | Collection.FolderID = f.folder_id; |
462 | zeroColl.Collection.FolderID = f.folder_id; | 264 | Collection.Descendents = 0; |
463 | zeroColl.Descendents = 0; | 265 | result.Add(Collection); |
464 | result.Add(zeroColl); | ||
465 | continue; | 266 | continue; |
466 | } | 267 | } |
467 | if(dolib && f.owner_id == libOwner) | 268 | if(dolib && f.owner_id == libOwner) |
@@ -474,10 +275,13 @@ namespace OpenSim.Capabilities.Handlers | |||
474 | } | 275 | } |
475 | if(otherIDs.Contains(f.folder_id)) | 276 | if(otherIDs.Contains(f.folder_id)) |
476 | continue; | 277 | continue; |
278 | |||
477 | otherIDs.Add(f.folder_id); | 279 | otherIDs.Add(f.folder_id); |
478 | otherFolders.Add(f); | 280 | otherFolders.Add(f); |
479 | } | 281 | } |
480 | 282 | ||
283 | fetchFolders.Clear(); | ||
284 | |||
481 | if(otherFolders.Count > 0) | 285 | if(otherFolders.Count > 0) |
482 | { | 286 | { |
483 | int i = 0; | 287 | int i = 0; |
@@ -501,25 +305,33 @@ namespace OpenSim.Capabilities.Handlers | |||
501 | foreach (InventoryCollection contents in fetchedContents) | 305 | foreach (InventoryCollection contents in fetchedContents) |
502 | { | 306 | { |
503 | // Find the original request | 307 | // Find the original request |
504 | LLSDFetchInventoryDescendents freq = otherFolders[i++]; | 308 | LLSDFetchInventoryDescendents freq = otherFolders[i]; |
505 | 309 | otherFolders[i]=null; | |
506 | InventoryCollectionWithDescendents coll = new InventoryCollectionWithDescendents(); | 310 | i++; |
507 | coll.Collection = contents; | ||
508 | 311 | ||
509 | if (BadFolder(freq, contents, bad_folders)) | 312 | if (BadFolder(freq, contents, bad_folders)) |
510 | continue; | 313 | continue; |
511 | 314 | ||
315 | if(!freq.fetch_folders) | ||
316 | contents.Folders.Clear(); | ||
317 | if(!freq.fetch_items) | ||
318 | contents.Items.Clear(); | ||
319 | |||
320 | contents.Descendents = contents.Items.Count + contents.Folders.Count; | ||
321 | |||
512 | // Next: link management | 322 | // Next: link management |
513 | ProcessLinks(freq, coll); | 323 | ProcessLinks(freq, contents); |
514 | 324 | ||
515 | result.Add(coll); | 325 | total_folders += contents.Folders.Count; |
326 | total_items += contents.Items.Count; | ||
327 | result.Add(contents); | ||
516 | } | 328 | } |
517 | } | 329 | } |
518 | } | 330 | } |
519 | 331 | ||
520 | if(dolib && libFolders.Count > 0) | 332 | if(dolib && libFolders.Count > 0) |
521 | { | 333 | { |
522 | AddLibraryFolders(libFolders, result); | 334 | AddLibraryFolders(libFolders, result, ref total_folders, ref total_items); |
523 | } | 335 | } |
524 | 336 | ||
525 | return result; | 337 | return result; |
@@ -552,123 +364,48 @@ namespace OpenSim.Capabilities.Handlers | |||
552 | return false; | 364 | return false; |
553 | } | 365 | } |
554 | 366 | ||
555 | private void ProcessLinks(LLSDFetchInventoryDescendents freq, InventoryCollectionWithDescendents coll) | 367 | private void ProcessLinks(LLSDFetchInventoryDescendents freq, InventoryCollection contents) |
556 | { | 368 | { |
557 | InventoryCollection contents = coll.Collection; | 369 | if (contents.Items == null || contents.Items.Count == 0) |
370 | return; | ||
558 | 371 | ||
559 | if (freq.fetch_items && contents.Items != null) | 372 | // viewers are lasy and want a copy of the linked item sent before the link to it |
373 | |||
374 | // look for item links | ||
375 | List<UUID> itemIDs = new List<UUID>(); | ||
376 | foreach (InventoryItemBase item in contents.Items) | ||
560 | { | 377 | { |
561 | // viewers are lasy and want a copy of the linked item sent before the link to it | 378 | //m_log.DebugFormat("[XXX]: {0} {1}", item.Name, item.AssetType); |
562 | 379 | if (item.AssetType == (int)AssetType.Link) | |
563 | // descendents must only include the links, not the linked items we add | 380 | itemIDs.Add(item.AssetID); |
564 | coll.Descendents = contents.Items.Count + contents.Folders.Count; | 381 | } |
565 | |||
566 | // look for item links | ||
567 | List<UUID> itemIDs = new List<UUID>(); | ||
568 | foreach (InventoryItemBase item in contents.Items) | ||
569 | { | ||
570 | //m_log.DebugFormat("[XXX]: {0} {1}", item.Name, item.AssetType); | ||
571 | if (item.AssetType == (int)AssetType.Link) | ||
572 | itemIDs.Add(item.AssetID); | ||
573 | } | ||
574 | 382 | ||
575 | // get the linked if any | 383 | // get the linked if any |
576 | if (itemIDs.Count > 0) | 384 | if (itemIDs.Count > 0) |
577 | { | 385 | { |
578 | InventoryItemBase[] linked = m_InventoryService.GetMultipleItems(freq.owner_id, itemIDs.ToArray()); | 386 | InventoryItemBase[] linked = m_InventoryService.GetMultipleItems(freq.owner_id, itemIDs.ToArray()); |
579 | if (linked == null) | ||
580 | { | ||
581 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | ||
582 | m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); | ||
583 | linked = new InventoryItemBase[itemIDs.Count]; | ||
584 | int i = 0; | ||
585 | foreach (UUID id in itemIDs) | ||
586 | { | ||
587 | linked[i++] = m_InventoryService.GetItem(freq.owner_id, id); | ||
588 | } | ||
589 | } | ||
590 | 387 | ||
591 | if (linked != null) | 388 | if (linked != null) |
389 | { | ||
390 | List<InventoryItemBase> linkedItems = new List<InventoryItemBase>(); | ||
391 | // check for broken | ||
392 | foreach (InventoryItemBase linkedItem in linked) | ||
592 | { | 393 | { |
593 | List<InventoryItemBase> linkedItems = new List<InventoryItemBase>(); | 394 | // Take care of genuinely broken links where the target doesn't exist |
594 | // check for broken | 395 | // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, |
595 | foreach (InventoryItemBase linkedItem in linked) | 396 | // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles |
397 | // rather than having to keep track of every folder requested in the recursion. | ||
398 | if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) | ||
596 | { | 399 | { |
597 | // Take care of genuinely broken links where the target doesn't exist | 400 | linkedItems.Add(linkedItem); |
598 | // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, | 401 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Added {0} {1} {2}", linkedItem.Name, linkedItem.AssetType, linkedItem.Folder); |
599 | // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles | ||
600 | // rather than having to keep track of every folder requested in the recursion. | ||
601 | if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) | ||
602 | { | ||
603 | linkedItems.Add(linkedItem); | ||
604 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Added {0} {1} {2}", linkedItem.Name, linkedItem.AssetType, linkedItem.Folder); | ||
605 | } | ||
606 | } | 402 | } |
607 | // insert them | ||
608 | if(linkedItems.Count > 0) | ||
609 | contents.Items.InsertRange(0,linkedItems); | ||
610 | } | 403 | } |
404 | // insert them | ||
405 | if(linkedItems.Count > 0) | ||
406 | contents.Items.InsertRange(0, linkedItems); | ||
611 | } | 407 | } |
612 | } | 408 | } |
613 | } | 409 | } |
614 | |||
615 | /// <summary> | ||
616 | /// Convert an internal inventory folder object into an LLSD object. | ||
617 | /// </summary> | ||
618 | /// <param name="invFolder"></param> | ||
619 | /// <returns></returns> | ||
620 | private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder) | ||
621 | { | ||
622 | LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder(); | ||
623 | llsdFolder.folder_id = invFolder.ID; | ||
624 | llsdFolder.parent_id = invFolder.ParentID; | ||
625 | llsdFolder.name = invFolder.Name; | ||
626 | llsdFolder.type = invFolder.Type; | ||
627 | llsdFolder.version = invFolder.Version; | ||
628 | llsdFolder.preferred_type = -1; | ||
629 | |||
630 | return llsdFolder; | ||
631 | } | ||
632 | |||
633 | /// <summary> | ||
634 | /// Convert an internal inventory item object into an LLSD object. | ||
635 | /// </summary> | ||
636 | /// <param name="invItem"></param> | ||
637 | /// <returns></returns> | ||
638 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
639 | { | ||
640 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
641 | llsdItem.asset_id = invItem.AssetID; | ||
642 | llsdItem.created_at = invItem.CreationDate; | ||
643 | llsdItem.desc = invItem.Description; | ||
644 | llsdItem.flags = (int)invItem.Flags; | ||
645 | llsdItem.item_id = invItem.ID; | ||
646 | llsdItem.name = invItem.Name; | ||
647 | llsdItem.parent_id = invItem.Folder; | ||
648 | llsdItem.type = invItem.AssetType; | ||
649 | llsdItem.inv_type = invItem.InvType; | ||
650 | |||
651 | llsdItem.permissions = new LLSDPermissions(); | ||
652 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | ||
653 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; | ||
654 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; | ||
655 | llsdItem.permissions.group_id = invItem.GroupID; | ||
656 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; | ||
657 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; | ||
658 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | ||
659 | llsdItem.permissions.owner_id = invItem.Owner; | ||
660 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | ||
661 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
662 | llsdItem.sale_info.sale_price = invItem.SalePrice; | ||
663 | llsdItem.sale_info.sale_type = invItem.SaleType; | ||
664 | |||
665 | return llsdItem; | ||
666 | } | ||
667 | } | ||
668 | |||
669 | class InventoryCollectionWithDescendents | ||
670 | { | ||
671 | public InventoryCollection Collection; | ||
672 | public int Descendents; | ||
673 | } | 410 | } |
674 | } | 411 | } |
diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs index 1a44660..483f735 100644 --- a/OpenSim/Framework/Culture.cs +++ b/OpenSim/Framework/Culture.cs | |||
@@ -1,66 +1 @@ | |||
1 | /* | /* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Globalization; using System.Threading; namespace OpenSim.Framework { public class Culture { private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", false); public static NumberFormatInfo NumberFormatInfo { get { return m_cultureInfo.NumberFormat; } } public static IFormatProvider FormatProvider { get { return m_cultureInfo; } } /// <summary> /// Set Culture to en-US to make string processing of numbers simpler. /// </summary> public static void SetCurrentCulture() { Thread.CurrentThread.CurrentCulture = m_cultureInfo; } public static void SetDefaultCurrentCulture() { CultureInfo.DefaultThreadCurrentCulture = m_cultureInfo; } public static CultureInfo GetDefaultCurrentCulture() { return CultureInfo.DefaultThreadCurrentCulture; } } } \ No newline at end of file | |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Globalization; | ||
30 | using System.Threading; | ||
31 | |||
32 | namespace OpenSim.Framework | ||
33 | { | ||
34 | public class Culture | ||
35 | { | ||
36 | private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", false); | ||
37 | |||
38 | public static NumberFormatInfo NumberFormatInfo | ||
39 | { | ||
40 | get { return m_cultureInfo.NumberFormat; } | ||
41 | } | ||
42 | |||
43 | public static IFormatProvider FormatProvider | ||
44 | { | ||
45 | get { return m_cultureInfo; } | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Set Culture to en-US to make string processing of numbers simpler. | ||
50 | /// </summary> | ||
51 | public static void SetCurrentCulture() | ||
52 | { | ||
53 | Thread.CurrentThread.CurrentCulture = m_cultureInfo; | ||
54 | } | ||
55 | |||
56 | public static void SetDefaultCurrentCulture() | ||
57 | { | ||
58 | CultureInfo.DefaultThreadCurrentCulture = m_cultureInfo; | ||
59 | } | ||
60 | |||
61 | public static CultureInfo GetDefaultCurrentCulture() | ||
62 | { | ||
63 | return CultureInfo.DefaultThreadCurrentCulture; | ||
64 | } | ||
65 | } | ||
66 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/InventoryCollection.cs b/OpenSim/Framework/InventoryCollection.cs index 59655eb..a55a1cb 100644 --- a/OpenSim/Framework/InventoryCollection.cs +++ b/OpenSim/Framework/InventoryCollection.cs | |||
@@ -40,5 +40,6 @@ namespace OpenSim.Framework | |||
40 | public UUID OwnerID; | 40 | public UUID OwnerID; |
41 | public UUID FolderID; | 41 | public UUID FolderID; |
42 | public int Version; | 42 | public int Version; |
43 | public int Descendents; | ||
43 | } | 44 | } |
44 | } | 45 | } |
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index ed5c4db..35fc964 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs | |||
@@ -159,7 +159,7 @@ namespace OpenSim.Framework | |||
159 | else | 159 | else |
160 | { | 160 | { |
161 | sb.Append("<real>"); | 161 | sb.Append("<real>"); |
162 | sb.Append(e.ToString(CultureInfo.InvariantCulture)); | 162 | sb.Append(e.ToString(CultureInfo.InvariantCulture)); |
163 | sb.Append("</real>"); | 163 | sb.Append("</real>"); |
164 | } | 164 | } |
165 | } | 165 | } |
@@ -173,7 +173,7 @@ namespace OpenSim.Framework | |||
173 | else | 173 | else |
174 | { | 174 | { |
175 | sb.Append("<real>"); | 175 | sb.Append("<real>"); |
176 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 176 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
177 | sb.Append("</real><key>y</key>"); | 177 | sb.Append("</real><key>y</key>"); |
178 | } | 178 | } |
179 | 179 | ||
@@ -196,7 +196,7 @@ namespace OpenSim.Framework | |||
196 | else | 196 | else |
197 | { | 197 | { |
198 | sb.Append("<real>"); | 198 | sb.Append("<real>"); |
199 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 199 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
200 | sb.Append("</real><key>y</key>"); | 200 | sb.Append("</real><key>y</key>"); |
201 | } | 201 | } |
202 | 202 | ||
@@ -228,7 +228,7 @@ namespace OpenSim.Framework | |||
228 | else | 228 | else |
229 | { | 229 | { |
230 | sb.Append("<real>"); | 230 | sb.Append("<real>"); |
231 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 231 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
232 | sb.Append("</real><key>y</key>"); | 232 | sb.Append("</real><key>y</key>"); |
233 | } | 233 | } |
234 | 234 | ||
@@ -347,7 +347,7 @@ namespace OpenSim.Framework | |||
347 | else | 347 | else |
348 | format = "yyyy-MM-ddTHH:mm:ssZ"; | 348 | format = "yyyy-MM-ddTHH:mm:ssZ"; |
349 | sb.Append("<date>"); | 349 | sb.Append("<date>"); |
350 | sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); | 350 | sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); |
351 | sb.Append("</date>"); | 351 | sb.Append("</date>"); |
352 | } | 352 | } |
353 | 353 | ||
@@ -478,7 +478,7 @@ namespace OpenSim.Framework | |||
478 | else | 478 | else |
479 | { | 479 | { |
480 | sb.Append("<real>"); | 480 | sb.Append("<real>"); |
481 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 481 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
482 | sb.Append("</real><key>y</key>"); | 482 | sb.Append("</real><key>y</key>"); |
483 | } | 483 | } |
484 | 484 | ||
@@ -503,7 +503,7 @@ namespace OpenSim.Framework | |||
503 | else | 503 | else |
504 | { | 504 | { |
505 | sb.Append("<real>"); | 505 | sb.Append("<real>"); |
506 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 506 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
507 | sb.Append("</real><key>y</key>"); | 507 | sb.Append("</real><key>y</key>"); |
508 | } | 508 | } |
509 | 509 | ||
@@ -537,7 +537,7 @@ namespace OpenSim.Framework | |||
537 | else | 537 | else |
538 | { | 538 | { |
539 | sb.Append("<real>"); | 539 | sb.Append("<real>"); |
540 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); | 540 | sb.Append(e.X.ToString(CultureInfo.InvariantCulture)); |
541 | sb.Append("</real><key>y</key>"); | 541 | sb.Append("</real><key>y</key>"); |
542 | } | 542 | } |
543 | 543 | ||
@@ -680,7 +680,7 @@ namespace OpenSim.Framework | |||
680 | else | 680 | else |
681 | format = "yyyy-MM-ddTHH:mm:ssZ"; | 681 | format = "yyyy-MM-ddTHH:mm:ssZ"; |
682 | sb.Append("<date>"); | 682 | sb.Append("<date>"); |
683 | sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); | 683 | sb.Append(u.ToString(format,CultureInfo.InvariantCulture)); |
684 | sb.Append("</date>"); | 684 | sb.Append("</date>"); |
685 | } | 685 | } |
686 | 686 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs index e4b9380..27b7679 100644 --- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs +++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs | |||
@@ -121,8 +121,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
121 | public byte SpecularLightColorB = 255; | 121 | public byte SpecularLightColorB = 255; |
122 | public byte SpecularLightColorA = 255; | 122 | public byte SpecularLightColorA = 255; |
123 | // data size 12 ints so far | 123 | // data size 12 ints so far |
124 | public UUID NormalMapID = UUID.Zero; | 124 | public UUID NormalMapID = UUID.Zero; |
125 | public UUID SpecularMapID = UUID.Zero; | 125 | public UUID SpecularMapID = UUID.Zero; |
126 | 126 | ||
127 | // other data | 127 | // other data |
128 | public UUID ID; | 128 | public UUID ID; |
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
134 | 134 | ||
135 | public FaceMaterial(FaceMaterial other) | 135 | public FaceMaterial(FaceMaterial other) |
136 | { | 136 | { |
137 | if(other == null) | 137 | if (other == null) |
138 | return; | 138 | return; |
139 | 139 | ||
140 | DiffuseAlphaMode = other.DiffuseAlphaMode; | 140 | DiffuseAlphaMode = other.DiffuseAlphaMode; |
@@ -160,32 +160,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | 160 | ||
161 | public FaceMaterial(OSDMap mat) | 161 | public FaceMaterial(OSDMap mat) |
162 | { | 162 | { |
163 | if(mat == null) | 163 | if (mat == null) |
164 | return; | 164 | return; |
165 | const float scale = 0.0001f; | 165 | const float scale = 0.0001f; |
166 | NormalMapID = mat["NormMap"].AsUUID(); | 166 | NormalMapID = mat["NormMap"].AsUUID(); |
167 | NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal(); | 167 | NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal(); |
168 | NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal(); | 168 | NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal(); |
169 | NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal(); | 169 | NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal(); |
170 | NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal(); | 170 | NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal(); |
171 | NormalRotation = scale * (float)mat["NormRotation"].AsReal(); | 171 | NormalRotation = scale * (float)mat["NormRotation"].AsReal(); |
172 | 172 | ||
173 | SpecularMapID = mat["SpecMap"].AsUUID(); | 173 | SpecularMapID = mat["SpecMap"].AsUUID(); |
174 | SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal(); | 174 | SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal(); |
175 | SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal(); | 175 | SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal(); |
176 | SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal(); | 176 | SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal(); |
177 | SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal(); | 177 | SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal(); |
178 | SpecularRotation = scale * (float)mat["SpecRotation"].AsReal(); | 178 | SpecularRotation = scale * (float)mat["SpecRotation"].AsReal(); |
179 | 179 | ||
180 | Color4 SpecularLightColortmp = mat["SpecColor"].AsColor4(); // we can read as color4 | 180 | Color4 SpecularLightColortmp = mat["SpecColor"].AsColor4(); // we can read as color4 |
181 | SpecularLightColorR = (byte)(SpecularLightColortmp.R); | 181 | SpecularLightColorR = (byte)(SpecularLightColortmp.R); |
182 | SpecularLightColorG = (byte)(SpecularLightColortmp.G); | 182 | SpecularLightColorG = (byte)(SpecularLightColortmp.G); |
183 | SpecularLightColorB = (byte)(SpecularLightColortmp.B); | 183 | SpecularLightColorB = (byte)(SpecularLightColortmp.B); |
184 | 184 | ||
185 | SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger(); | 185 | SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger(); |
186 | EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger(); | 186 | EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger(); |
187 | DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger(); | 187 | DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger(); |
188 | AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger(); | 188 | AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger(); |
189 | } | 189 | } |
190 | 190 | ||
191 | public void genID() | 191 | public void genID() |
@@ -198,29 +198,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | 198 | ||
199 | public unsafe override int GetHashCode() | 199 | public unsafe override int GetHashCode() |
200 | { | 200 | { |
201 | if(!validinthash) | 201 | if (!validinthash) |
202 | { | 202 | { |
203 | unchecked | 203 | unchecked |
204 | { | 204 | { |
205 | // if you don't like this, don't read... | 205 | // if you don't like this, don't read... |
206 | int* ptr; | 206 | int* ptr; |
207 | fixed(byte* ptrbase = &DiffuseAlphaMode) | 207 | fixed (byte* ptrbase = &DiffuseAlphaMode) |
208 | { | 208 | { |
209 | ptr = (int*)ptrbase; | 209 | ptr = (int*)ptrbase; |
210 | inthash = *ptr; | 210 | inthash = *ptr; |
211 | for(int i = 0; i < 11; i++) | 211 | for (int i = 0; i < 11; i++) |
212 | inthash ^= *ptr++; | 212 | inthash ^= *ptr++; |
213 | } | 213 | } |
214 | fixed(Guid* ptrbase = &NormalMapID.Guid) | 214 | fixed (Guid* ptrbase = &NormalMapID.Guid) |
215 | { | 215 | { |
216 | ptr = (int*)ptrbase; | 216 | ptr = (int*)ptrbase; |
217 | for(int i = 0; i < 16; i++) | 217 | for (int i = 0; i < 16; i++) |
218 | inthash ^= ptr[i]; | 218 | inthash ^= ptr[i]; |
219 | } | 219 | } |
220 | fixed(Guid* ptrbase = &SpecularMapID.Guid) | 220 | fixed (Guid* ptrbase = &SpecularMapID.Guid) |
221 | { | 221 | { |
222 | ptr = (int*)ptrbase; | 222 | ptr = (int*)ptrbase; |
223 | for(int i = 0; i < 16; i++) | 223 | for (int i = 0; i < 16; i++) |
224 | inthash ^= ptr[i]; | 224 | inthash ^= ptr[i]; |
225 | } | 225 | } |
226 | } | 226 | } |
@@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
231 | 231 | ||
232 | public override bool Equals(Object o) | 232 | public override bool Equals(Object o) |
233 | { | 233 | { |
234 | if(o == null || !(o is FaceMaterial)) | 234 | if (o == null || !(o is FaceMaterial)) |
235 | return false; | 235 | return false; |
236 | 236 | ||
237 | FaceMaterial other = (FaceMaterial)o; | 237 | FaceMaterial other = (FaceMaterial)o; |
@@ -264,18 +264,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | float scale = 10000f; | 264 | float scale = 10000f; |
265 | 265 | ||
266 | mat["NormMap"] = NormalMapID; | 266 | mat["NormMap"] = NormalMapID; |
267 | mat["NormOffsetX"] = (int) (scale * NormalOffsetX); | 267 | mat["NormOffsetX"] = (int)(scale * NormalOffsetX); |
268 | mat["NormOffsetY"] = (int) (scale * NormalOffsetY); | 268 | mat["NormOffsetY"] = (int)(scale * NormalOffsetY); |
269 | mat["NormRepeatX"] = (int) (scale * NormalRepeatX); | 269 | mat["NormRepeatX"] = (int)(scale * NormalRepeatX); |
270 | mat["NormRepeatY"] = (int) (scale * NormalRepeatY); | 270 | mat["NormRepeatY"] = (int)(scale * NormalRepeatY); |
271 | mat["NormRotation"] = (int) (scale * NormalRotation); | 271 | mat["NormRotation"] = (int)(scale * NormalRotation); |
272 | 272 | ||
273 | mat["SpecMap"] = SpecularMapID; | 273 | mat["SpecMap"] = SpecularMapID; |
274 | mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX); | 274 | mat["SpecOffsetX"] = (int)(scale * SpecularOffsetX); |
275 | mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY); | 275 | mat["SpecOffsetY"] = (int)(scale * SpecularOffsetY); |
276 | mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX); | 276 | mat["SpecRepeatX"] = (int)(scale * SpecularRepeatX); |
277 | mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY); | 277 | mat["SpecRepeatY"] = (int)(scale * SpecularRepeatY); |
278 | mat["SpecRotation"] = (int) (scale * SpecularRotation); | 278 | mat["SpecRotation"] = (int)(scale * SpecularRotation); |
279 | 279 | ||
280 | OSDArray carray = new OSDArray(4); | 280 | OSDArray carray = new OSDArray(4); |
281 | carray.Add(SpecularLightColorR); | 281 | carray.Add(SpecularLightColorR); |
@@ -283,10 +283,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
283 | carray.Add(SpecularLightColorB); | 283 | carray.Add(SpecularLightColorB); |
284 | carray.Add(255); // solid color | 284 | carray.Add(255); // solid color |
285 | mat["SpecColor"] = carray; | 285 | mat["SpecColor"] = carray; |
286 | mat["SpecExp"] = SpecularLightExponent; | 286 | mat["SpecExp"] = SpecularLightExponent; |
287 | mat["EnvIntensity"] = EnvironmentIntensity; | 287 | mat["EnvIntensity"] = EnvironmentIntensity; |
288 | mat["DiffuseAlphaMode"] = DiffuseAlphaMode; | 288 | mat["DiffuseAlphaMode"] = DiffuseAlphaMode; |
289 | mat["AlphaMaskCutoff"] = AlphaMaskCutoff; | 289 | mat["AlphaMaskCutoff"] = AlphaMaskCutoff; |
290 | 290 | ||
291 | return mat; | 291 | return mat; |
292 | } | 292 | } |
@@ -295,27 +295,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | { | 295 | { |
296 | const float scale = 10000f; | 296 | const float scale = 10000f; |
297 | bool fullLLSD = false; | 297 | bool fullLLSD = false; |
298 | if(sb == null) | 298 | if (sb == null) |
299 | { | 299 | { |
300 | 300 | ||
301 | sb = LLSDxmlEncode.Start(1024,false); | 301 | sb = LLSDxmlEncode.Start(1024, false); |
302 | fullLLSD = true; | 302 | fullLLSD = true; |
303 | } | 303 | } |
304 | 304 | ||
305 | LLSDxmlEncode.AddMap(sb); | 305 | LLSDxmlEncode.AddMap(sb); |
306 | LLSDxmlEncode.AddElem("NormMap", NormalMapID, sb); | 306 | LLSDxmlEncode.AddElem("NormMap", NormalMapID, sb); |
307 | LLSDxmlEncode.AddElem("NormOffsetX", (int) (scale * NormalOffsetX + 0.5f), sb); | 307 | LLSDxmlEncode.AddElem("NormOffsetX", (int)(scale * NormalOffsetX + 0.5f), sb); |
308 | LLSDxmlEncode.AddElem("NormOffsetY", (int) (scale * NormalOffsetY + 0.5f), sb); | 308 | LLSDxmlEncode.AddElem("NormOffsetY", (int)(scale * NormalOffsetY + 0.5f), sb); |
309 | LLSDxmlEncode.AddElem("NormRepeatX", (int) (scale * NormalRepeatX + 0.5f), sb); | 309 | LLSDxmlEncode.AddElem("NormRepeatX", (int)(scale * NormalRepeatX + 0.5f), sb); |
310 | LLSDxmlEncode.AddElem("NormRepeatY", (int) (scale * NormalRepeatY + 0.5f), sb); | 310 | LLSDxmlEncode.AddElem("NormRepeatY", (int)(scale * NormalRepeatY + 0.5f), sb); |
311 | LLSDxmlEncode.AddElem("NormRotation", (int) (scale * NormalRotation + 0.5f), sb); | 311 | LLSDxmlEncode.AddElem("NormRotation", (int)(scale * NormalRotation + 0.5f), sb); |
312 | 312 | ||
313 | LLSDxmlEncode.AddElem("SpecMap", SpecularMapID, sb); | 313 | LLSDxmlEncode.AddElem("SpecMap", SpecularMapID, sb); |
314 | LLSDxmlEncode.AddElem("SpecOffsetX", (int) (scale * SpecularOffsetX + 0.5f), sb); | 314 | LLSDxmlEncode.AddElem("SpecOffsetX", (int)(scale * SpecularOffsetX + 0.5f), sb); |
315 | LLSDxmlEncode.AddElem("SpecOffsetY", (int) (scale * SpecularOffsetY + 0.5f), sb); | 315 | LLSDxmlEncode.AddElem("SpecOffsetY", (int)(scale * SpecularOffsetY + 0.5f), sb); |
316 | LLSDxmlEncode.AddElem("SpecRepeatX", (int) (scale * SpecularRepeatX + 0.5f), sb); | 316 | LLSDxmlEncode.AddElem("SpecRepeatX", (int)(scale * SpecularRepeatX + 0.5f), sb); |
317 | LLSDxmlEncode.AddElem("SpecRepeatY", (int) (scale * SpecularRepeatY + 0.5f), sb); | 317 | LLSDxmlEncode.AddElem("SpecRepeatY", (int)(scale * SpecularRepeatY + 0.5f), sb); |
318 | LLSDxmlEncode.AddElem("SpecRotation", (int) (scale * SpecularRotation + 0.5f), sb); | 318 | LLSDxmlEncode.AddElem("SpecRotation", (int)(scale * SpecularRotation + 0.5f), sb); |
319 | 319 | ||
320 | LLSDxmlEncode.AddArray("SpecColor", sb); | 320 | LLSDxmlEncode.AddArray("SpecColor", sb); |
321 | LLSDxmlEncode.AddElem(SpecularLightColorR, sb); | 321 | LLSDxmlEncode.AddElem(SpecularLightColorR, sb); |
@@ -324,14 +324,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | LLSDxmlEncode.AddElem(255, sb); | 324 | LLSDxmlEncode.AddElem(255, sb); |
325 | LLSDxmlEncode.AddEndArray(sb); | 325 | LLSDxmlEncode.AddEndArray(sb); |
326 | 326 | ||
327 | LLSDxmlEncode.AddElem("SpecExp", SpecularLightExponent, sb); | 327 | LLSDxmlEncode.AddElem("SpecExp", SpecularLightExponent, sb); |
328 | LLSDxmlEncode.AddElem("EnvIntensity", EnvironmentIntensity, sb); | 328 | LLSDxmlEncode.AddElem("EnvIntensity", EnvironmentIntensity, sb); |
329 | LLSDxmlEncode.AddElem("DiffuseAlphaMode", DiffuseAlphaMode, sb); | 329 | LLSDxmlEncode.AddElem("DiffuseAlphaMode", DiffuseAlphaMode, sb); |
330 | LLSDxmlEncode.AddElem("AlphaMaskCutoff", AlphaMaskCutoff, sb); | 330 | LLSDxmlEncode.AddElem("AlphaMaskCutoff", AlphaMaskCutoff, sb); |
331 | 331 | ||
332 | LLSDxmlEncode.AddEndMap(sb); | 332 | LLSDxmlEncode.AddEndMap(sb); |
333 | 333 | ||
334 | if(fullLLSD) | 334 | if (fullLLSD) |
335 | { | 335 | { |
336 | return LLSDxmlEncode.End(sb); | 336 | return LLSDxmlEncode.End(sb); |
337 | } | 337 | } |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 6a4ef1e..7397218 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -442,7 +442,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
442 | while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) | 442 | while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) |
443 | outMs.Write(readBuffer, 0, readLen); | 443 | outMs.Write(readBuffer, 0, readLen); |
444 | 444 | ||
445 | outMs.Flush(); | ||
446 | outMs.Seek(0, SeekOrigin.Begin); | 445 | outMs.Seek(0, SeekOrigin.Begin); |
447 | 446 | ||
448 | byte[] decompressedBuf = outMs.GetBuffer(); | 447 | byte[] decompressedBuf = outMs.GetBuffer(); |