diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
16 files changed, 274 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index ec260b4..0f422ae 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -114,7 +114,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
114 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin"); | 114 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin"); |
115 | if (m_RestrictInventoryAccessAbroad) | 115 | if (m_RestrictInventoryAccessAbroad) |
116 | { | 116 | { |
117 | RestoreRootFolderContents(client); | 117 | IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); |
118 | if (uMan.IsLocalGridUser(client.AgentId)) | ||
119 | { | ||
120 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
121 | RestoreRootFolderContents(client); | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is foreign"); | ||
126 | RestoreSuitcaseFolderContents(client); | ||
127 | } | ||
118 | } | 128 | } |
119 | } | 129 | } |
120 | } | 130 | } |
@@ -210,7 +220,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | logout = success; // flag for later logout from this grid; this is an HG TP | 220 | logout = success; // flag for later logout from this grid; this is an HG TP |
211 | 221 | ||
212 | if (success && m_RestrictInventoryAccessAbroad) | 222 | if (success && m_RestrictInventoryAccessAbroad) |
213 | RemoveRootFolderContents(sp.ControllingClient); | 223 | { |
224 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | ||
225 | if (uMan != null && uMan.IsLocalGridUser(sp.UUID)) | ||
226 | { | ||
227 | // local grid user | ||
228 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
229 | RemoveRootFolderContents(sp.ControllingClient); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is foreign"); | ||
234 | RemoveSuitcaseFolderContents(sp.ControllingClient); | ||
235 | } | ||
236 | } | ||
214 | 237 | ||
215 | return success; | 238 | return success; |
216 | } | 239 | } |
@@ -401,25 +424,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
401 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 424 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
402 | if (root != null) | 425 | if (root != null) |
403 | { | 426 | { |
404 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId); | 427 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.Name); |
405 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | 428 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
406 | UUID[] ids = new UUID[content.Folders.Count]; | 429 | List<UUID> fids = new List<UUID>(); |
407 | int i = 0; | 430 | List<UUID> iids = new List<UUID>(); |
431 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | ||
432 | |||
408 | foreach (InventoryFolderBase f in content.Folders) | 433 | foreach (InventoryFolderBase f in content.Folders) |
409 | ids[i++] = f.ID; | 434 | { |
410 | inv.SendRemoveInventoryFolders(ids); | 435 | if (f.Name != "My Suitcase") |
411 | ids = new UUID[content.Items.Count]; | 436 | { |
412 | i = 0; | 437 | f.Name = f.Name + " (Unavailable)"; |
438 | keep.Add(f); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | // items directly under the root folder | ||
413 | foreach (InventoryItemBase it in content.Items) | 443 | foreach (InventoryItemBase it in content.Items) |
414 | ids[i++] = it.ID; | 444 | it.Name = it.Name + " (Unavailable)"; ; |
415 | inv.SendRemoveInventoryItems(ids); | 445 | |
446 | // Send the new names | ||
447 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); | ||
448 | |||
416 | } | 449 | } |
417 | } | 450 | } |
418 | } | 451 | } |
419 | } | 452 | } |
420 | 453 | ||
454 | private void RemoveSuitcaseFolderContents(IClientAPI client) | ||
455 | { | ||
456 | } | ||
457 | |||
421 | private void RestoreRootFolderContents(IClientAPI client) | 458 | private void RestoreRootFolderContents(IClientAPI client) |
422 | { | 459 | { |
460 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root folder"); | ||
423 | if (client is IClientCore) | 461 | if (client is IClientCore) |
424 | { | 462 | { |
425 | IClientCore core = (IClientCore)client; | 463 | IClientCore core = (IClientCore)client; |
@@ -428,21 +466,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
428 | if (core.TryGet<IClientInventory>(out inv)) | 466 | if (core.TryGet<IClientInventory>(out inv)) |
429 | { | 467 | { |
430 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 468 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
431 | client.SendBulkUpdateInventory(root); | 469 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
432 | //if (root != null) | 470 | |
433 | //{ | 471 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); |
434 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
435 | // InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
436 | // m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID); | ||
437 | // foreach (InventoryItemBase i in content.Items) | ||
438 | // m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder); | ||
439 | |||
440 | // inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | ||
441 | //} | ||
442 | } | 472 | } |
443 | } | 473 | } |
444 | } | 474 | } |
445 | 475 | ||
476 | private void RestoreSuitcaseFolderContents(IClientAPI client) | ||
477 | { | ||
478 | } | ||
479 | |||
446 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 480 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
447 | { | 481 | { |
448 | GridRegion region = new GridRegion(); | 482 | GridRegion region = new GridRegion(); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 4be3804..cf6d2f7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -297,14 +297,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
297 | return m_LocalGridInventoryService.CreateUserInventory(userID); | 297 | return m_LocalGridInventoryService.CreateUserInventory(userID); |
298 | } | 298 | } |
299 | 299 | ||
300 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 300 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userID) |
301 | { | 301 | { |
302 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | 302 | string invURL = GetInventoryServiceURL(userID); |
303 | |||
304 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
305 | return m_LocalGridInventoryService.GetInventorySkeleton(userID); | ||
306 | |||
307 | IInventoryService connector = GetConnector(invURL); | ||
308 | |||
309 | return connector.GetInventorySkeleton(userID); | ||
303 | } | 310 | } |
304 | 311 | ||
305 | public InventoryCollection GetUserInventory(UUID userID) | 312 | public InventoryCollection GetUserInventory(UUID userID) |
306 | { | 313 | { |
307 | return null; | 314 | string invURL = GetInventoryServiceURL(userID); |
315 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetUserInventory for {0} {1}", userID, invURL); | ||
316 | |||
317 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
318 | return m_LocalGridInventoryService.GetUserInventory(userID); | ||
319 | |||
320 | InventoryCollection c = m_Cache.GetUserInventory(userID); | ||
321 | if (c != null) | ||
322 | return c; | ||
323 | |||
324 | IInventoryService connector = GetConnector(invURL); | ||
325 | c = connector.GetUserInventory(userID); | ||
326 | |||
327 | m_Cache.Cache(userID, c); | ||
328 | return c; | ||
308 | } | 329 | } |
309 | 330 | ||
310 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 331 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
@@ -362,8 +383,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
362 | if (invURL == null) // not there, forward to local inventory connector to resolve | 383 | if (invURL == null) // not there, forward to local inventory connector to resolve |
363 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | 384 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); |
364 | 385 | ||
365 | IInventoryService connector = GetConnector(invURL); | 386 | InventoryCollection c = m_Cache.GetFolderContent(userID, folderID); |
387 | if (c != null) | ||
388 | { | ||
389 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent found content in cache " + folderID); | ||
390 | return c; | ||
391 | } | ||
366 | 392 | ||
393 | IInventoryService connector = GetConnector(invURL); | ||
367 | return connector.GetFolderContent(userID, folderID); | 394 | return connector.GetFolderContent(userID, folderID); |
368 | 395 | ||
369 | } | 396 | } |
@@ -377,8 +404,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
377 | if (invURL == null) // not there, forward to local inventory connector to resolve | 404 | if (invURL == null) // not there, forward to local inventory connector to resolve |
378 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | 405 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); |
379 | 406 | ||
380 | IInventoryService connector = GetConnector(invURL); | 407 | List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID); |
408 | if (items != null) | ||
409 | { | ||
410 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems found items in cache " + folderID); | ||
411 | return items; | ||
412 | } | ||
381 | 413 | ||
414 | IInventoryService connector = GetConnector(invURL); | ||
382 | return connector.GetFolderItems(userID, folderID); | 415 | return connector.GetFolderItems(userID, folderID); |
383 | 416 | ||
384 | } | 417 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 0fe778d..1e434b9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -12,6 +12,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
12 | 12 | ||
13 | private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); | 13 | private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); |
14 | private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); | 14 | private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); |
15 | private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>(); | ||
15 | 16 | ||
16 | public void Cache(UUID userID, InventoryFolderBase root) | 17 | public void Cache(UUID userID, InventoryFolderBase root) |
17 | { | 18 | { |
@@ -55,5 +56,55 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
55 | 56 | ||
56 | return null; | 57 | return null; |
57 | } | 58 | } |
59 | |||
60 | public void Cache(UUID userID, InventoryCollection inv) | ||
61 | { | ||
62 | lock (m_Inventories) | ||
63 | m_Inventories.AddOrUpdate(userID, inv, 120); | ||
64 | } | ||
65 | |||
66 | public InventoryCollection GetUserInventory(UUID userID) | ||
67 | { | ||
68 | InventoryCollection inv = null; | ||
69 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
70 | return inv; | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
75 | { | ||
76 | InventoryCollection inv = null; | ||
77 | InventoryCollection c; | ||
78 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
79 | { | ||
80 | c = new InventoryCollection(); | ||
81 | c.UserID = userID; | ||
82 | |||
83 | c.Folders = inv.Folders.FindAll(delegate(InventoryFolderBase f) | ||
84 | { | ||
85 | return f.ParentID == folderID; | ||
86 | }); | ||
87 | c.Items = inv.Items.FindAll(delegate(InventoryItemBase i) | ||
88 | { | ||
89 | return i.Folder == folderID; | ||
90 | }); | ||
91 | return c; | ||
92 | } | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
97 | { | ||
98 | InventoryCollection inv = null; | ||
99 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
100 | { | ||
101 | List<InventoryItemBase> items = inv.Items.FindAll(delegate(InventoryItemBase i) | ||
102 | { | ||
103 | return i.Folder == folderID; | ||
104 | }); | ||
105 | return items; | ||
106 | } | ||
107 | return null; | ||
108 | } | ||
58 | } | 109 | } |
59 | } | 110 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 77573c3..990dffb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
172 | 172 | ||
173 | public InventoryCollection GetUserInventory(UUID userID) | 173 | public InventoryCollection GetUserInventory(UUID userID) |
174 | { | 174 | { |
175 | return null; | 175 | return m_RemoteConnector.GetUserInventory(userID); |
176 | } | 176 | } |
177 | 177 | ||
178 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 178 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
@@ -193,16 +193,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
193 | { | 193 | { |
194 | InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); | 194 | InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); |
195 | 195 | ||
196 | if (UserManager != null) | 196 | if (invCol != null && UserManager != null) |
197 | { | 197 | { |
198 | // Protect ourselves against the caller subsequently modifying the items list | 198 | // Protect ourselves against the caller subsequently modifying the items list |
199 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); | 199 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); |
200 | 200 | ||
201 | Util.FireAndForget(delegate | 201 | if (items != null && items.Count > 0) |
202 | { | 202 | Util.FireAndForget(delegate |
203 | foreach (InventoryItemBase item in items) | 203 | { |
204 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 204 | foreach (InventoryItemBase item in items) |
205 | }); | 205 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); |
206 | }); | ||
206 | } | 207 | } |
207 | 208 | ||
208 | return invCol; | 209 | return invCol; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index a0ed5a5..ced7b52 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -56,6 +56,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
58 | 58 | ||
59 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | ||
60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | ||
61 | |||
59 | public bool[,] LandBitmap | 62 | public bool[,] LandBitmap |
60 | { | 63 | { |
61 | get { return m_landBitmap; } | 64 | get { return m_landBitmap; } |
@@ -417,6 +420,45 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
417 | return false; | 420 | return false; |
418 | } | 421 | } |
419 | 422 | ||
423 | public bool HasGroupAccess(UUID avatar) | ||
424 | { | ||
425 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
426 | { | ||
427 | ScenePresence sp; | ||
428 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
429 | { | ||
430 | bool isMember; | ||
431 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) | ||
432 | return isMember; | ||
433 | |||
434 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
435 | if (groupsModule == null) | ||
436 | return false; | ||
437 | |||
438 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
439 | if (membership == null || membership.Length == 0) | ||
440 | { | ||
441 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
442 | return false; | ||
443 | } | ||
444 | |||
445 | foreach (GroupMembershipData d in membership) | ||
446 | { | ||
447 | if (d.GroupID == LandData.GroupID) | ||
448 | { | ||
449 | m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout); | ||
450 | return true; | ||
451 | } | ||
452 | } | ||
453 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
454 | return false; | ||
455 | } | ||
456 | |||
457 | return sp.ControllingClient.IsGroupMember(LandData.GroupID); | ||
458 | } | ||
459 | return false; | ||
460 | } | ||
461 | |||
420 | public bool IsBannedFromLand(UUID avatar) | 462 | public bool IsBannedFromLand(UUID avatar) |
421 | { | 463 | { |
422 | ExpireAccessList(); | 464 | ExpireAccessList(); |
@@ -448,6 +490,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
448 | 490 | ||
449 | public bool IsRestrictedFromLand(UUID avatar) | 491 | public bool IsRestrictedFromLand(UUID avatar) |
450 | { | 492 | { |
493 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) | ||
494 | return false; | ||
495 | |||
451 | if (m_scene.Permissions.IsAdministrator(avatar)) | 496 | if (m_scene.Permissions.IsAdministrator(avatar)) |
452 | return false; | 497 | return false; |
453 | 498 | ||
@@ -457,10 +502,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
457 | if (avatar == LandData.OwnerID) | 502 | if (avatar == LandData.OwnerID) |
458 | return false; | 503 | return false; |
459 | 504 | ||
460 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) | 505 | if (HasGroupAccess(avatar)) |
461 | return false; | 506 | return false; |
462 | 507 | ||
463 | return (!IsInLandAccessList(avatar)); | 508 | return !IsInLandAccessList(avatar); |
464 | } | 509 | } |
465 | 510 | ||
466 | public bool IsInLandAccessList(UUID avatar) | 511 | public bool IsInLandAccessList(UUID avatar) |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs index 90f124b..fb57c82 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs | |||
@@ -72,5 +72,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
72 | { | 72 | { |
73 | return "BMP"; | 73 | return "BMP"; |
74 | } | 74 | } |
75 | |||
76 | //Returns true if this extension is supported for terrain save-tile | ||
77 | public override bool SupportsTileSave() | ||
78 | { | ||
79 | return false; | ||
80 | } | ||
75 | } | 81 | } |
76 | } | 82 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs index f331b56..79cc50b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "GIF"; | 58 | return "GIF"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public override bool SupportsTileSave() | ||
63 | { | ||
64 | return false; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 58925fd..da81dc1 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -177,6 +177,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
177 | return "SYS.DRAWING"; | 177 | return "SYS.DRAWING"; |
178 | } | 178 | } |
179 | 179 | ||
180 | //Returns true if this extension is supported for terrain save-tile | ||
181 | public virtual bool SupportsTileSave() | ||
182 | { | ||
183 | return false; | ||
184 | } | ||
185 | |||
180 | /// <summary> | 186 | /// <summary> |
181 | /// Protected method, generates a grayscale bitmap | 187 | /// Protected method, generates a grayscale bitmap |
182 | /// image from a specified terrain channel. | 188 | /// image from a specified terrain channel. |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 1a0d8ec..699d67a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -91,6 +91,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
91 | return "JPEG"; | 91 | return "JPEG"; |
92 | } | 92 | } |
93 | 93 | ||
94 | //Returns true if this extension is supported for terrain save-tile | ||
95 | public bool SupportsTileSave() | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
94 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
95 | { | 101 | { |
96 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 102 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs index fad7641..62d232e 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs | |||
@@ -254,5 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
254 | { | 254 | { |
255 | return "LL/SL RAW"; | 255 | return "LL/SL RAW"; |
256 | } | 256 | } |
257 | |||
258 | //Returns true if this extension is supported for terrain save-tile | ||
259 | public bool SupportsTileSave() | ||
260 | { | ||
261 | return false; | ||
262 | } | ||
263 | |||
257 | } | 264 | } |
258 | } | 265 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs index e009ecf..c5c12ae 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "PNG"; | 58 | return "PNG"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public override bool SupportsTileSave() | ||
63 | { | ||
64 | return true; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs index ba073ca..9fb7ef7 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs | |||
@@ -173,5 +173,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
173 | { | 173 | { |
174 | return "RAW32"; | 174 | return "RAW32"; |
175 | } | 175 | } |
176 | |||
177 | //Returns true if this extension is supported for terrain save-tile | ||
178 | public bool SupportsTileSave() | ||
179 | { | ||
180 | return false; | ||
181 | } | ||
176 | } | 182 | } |
177 | } | 183 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index fc1ad33..5d2f893 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "TIFF"; | 58 | return "TIFF"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public bool SupportsTileSave() | ||
63 | { | ||
64 | return false; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs index 2f37d9d..1ebf916 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs | |||
@@ -323,6 +323,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
323 | return "Terragen"; | 323 | return "Terragen"; |
324 | } | 324 | } |
325 | 325 | ||
326 | //Returns true if this extension is supported for terrain save-tile | ||
327 | public bool SupportsTileSave() | ||
328 | { | ||
329 | return false; | ||
330 | } | ||
331 | |||
326 | /// <summary> | 332 | /// <summary> |
327 | /// terragen SCAL floats need to be written intel ordered regardless of | 333 | /// terragen SCAL floats need to be written intel ordered regardless of |
328 | /// big or little endian system | 334 | /// big or little endian system |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs index d407617..3ba3657 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs | |||
@@ -32,6 +32,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
32 | { | 32 | { |
33 | public interface ITerrainLoader | 33 | public interface ITerrainLoader |
34 | { | 34 | { |
35 | // Returns true if that extension can be used for terrain save-tile | ||
36 | // (Look into each file in Region.CoreModules.World.Terrain.FileLoaders) | ||
37 | bool SupportsTileSave(); | ||
38 | |||
35 | string FileExtension { get; } | 39 | string FileExtension { get; } |
36 | ITerrainChannel LoadFile(string filename); | 40 | ITerrainChannel LoadFile(string filename); |
37 | ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); | 41 | ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index b3c2969..8535a5a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -93,6 +93,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
93 | /// </summary> | 93 | /// </summary> |
94 | private string m_supportedFileExtensions = ""; | 94 | private string m_supportedFileExtensions = ""; |
95 | 95 | ||
96 | //For terrain save-tile file extensions | ||
97 | private string m_supportFileExtensionsForTileSave = ""; | ||
98 | |||
96 | #region ICommandableModule Members | 99 | #region ICommandableModule Members |
97 | 100 | ||
98 | public ICommander CommandInterface | 101 | public ICommander CommandInterface |
@@ -148,11 +151,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
148 | 151 | ||
149 | // Generate user-readable extensions list | 152 | // Generate user-readable extensions list |
150 | string supportedFilesSeparator = ""; | 153 | string supportedFilesSeparator = ""; |
154 | string supportedFilesSeparatorForTileSave = ""; | ||
151 | 155 | ||
156 | m_supportFileExtensionsForTileSave = ""; | ||
152 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 157 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
153 | { | 158 | { |
154 | m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; | 159 | m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; |
155 | supportedFilesSeparator = ", "; | 160 | supportedFilesSeparator = ", "; |
161 | |||
162 | //For terrain save-tile file extensions | ||
163 | if (loader.Value.SupportsTileSave() == true) | ||
164 | { | ||
165 | m_supportFileExtensionsForTileSave += supportedFilesSeparatorForTileSave + loader.Key + " (" + loader.Value + ")"; | ||
166 | supportedFilesSeparatorForTileSave = ", "; | ||
167 | } | ||
156 | } | 168 | } |
157 | } | 169 | } |
158 | 170 | ||
@@ -589,7 +601,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
589 | // this region is included in the tile request | 601 | // this region is included in the tile request |
590 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 602 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
591 | { | 603 | { |
592 | if (filename.EndsWith(loader.Key)) | 604 | if (filename.EndsWith(loader.Key) && loader.Value.SupportsTileSave()) |
593 | { | 605 | { |
594 | lock (m_scene) | 606 | lock (m_scene) |
595 | { | 607 | { |
@@ -610,7 +622,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
610 | 622 | ||
611 | MainConsole.Instance.OutputFormat( | 623 | MainConsole.Instance.OutputFormat( |
612 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | 624 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", |
613 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | 625 | m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave); |
614 | } | 626 | } |
615 | 627 | ||
616 | /// <summary> | 628 | /// <summary> |
@@ -1192,7 +1204,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1192 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); | 1204 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); |
1193 | saveToTileCommand.AddArgument("filename", | 1205 | saveToTileCommand.AddArgument("filename", |
1194 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + | 1206 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + |
1195 | m_supportedFileExtensions, "String"); | 1207 | m_supportFileExtensionsForTileSave, "String"); |
1196 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); | 1208 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); |
1197 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); | 1209 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); |
1198 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", | 1210 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", |