From 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Wed, 4 Feb 2009 00:01:36 +0000 Subject: - add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it - trim trailing whitespace --- .../AssetTransaction/AgentAssetsTransactions.cs | 26 +-- .../Agent/AssetTransaction/AssetXferUploader.cs | 36 ++-- .../Modules/Agent/TextureSender/TextureSender.cs | 16 +- .../Archiver/InventoryArchiveReadRequest.cs | 36 ++-- .../DynamicTexture/DynamicTextureModule.cs | 20 +-- .../Modules/World/Archiver/ArchiveReadRequest.cs | 46 +++--- .../Modules/World/Archiver/AssetsArchiver.cs | 16 +- .../Modules/World/Archiver/AssetsDearchiver.cs | 4 +- .../World/Estate/EstateTerrainXferHandler.cs | 28 ++-- .../Environment/Scenes/Hypergrid/HGAssetMapper.cs | 68 ++++---- .../Region/Environment/Scenes/Scene.Inventory.cs | 184 ++++++++++----------- OpenSim/Region/Environment/Scenes/Scene.cs | 120 +++++++------- 12 files changed, 300 insertions(+), 300 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 689b4d5..7f4bb0b 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } public void HandleXfer(ulong xferID, uint packetID, byte[] data) - { + { lock (XferUploaders) { foreach (AssetXferUploader uploader in XferUploaders.Values) @@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction wearableType, nextOwnerMask); } } - - + + /// /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. @@ -171,10 +171,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", item.Name, part.Name, transactionID); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.Type; - item.AssetID = asset.FullID; + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.Type; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); @@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction asset = GetTransactionAsset(transactionID); } - if (asset != null && asset.FullID == assetID) + if (asset != null && asset.Metadata.FullID == assetID) { // Assets never get updated, new ones get created - asset.FullID = UUID.Random(); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.AssetType; - item.AssetID = asset.FullID; + asset.Metadata.FullID = UUID.Random(); + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.AssetType; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); } diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs index 6dcbe83..5387165 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs @@ -113,17 +113,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { ourClient = remoteClient; m_asset = new AssetBase(); - m_asset.FullID = assetID; - m_asset.Type = type; + m_asset.Metadata.FullID = assetID; + m_asset.Metadata.Type = type; m_asset.Data = data; - m_asset.Name = "blank"; - m_asset.Description = "empty"; - m_asset.Local = storeLocal; - m_asset.Temporary = tempFile; + m_asset.Metadata.Name = "blank"; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = storeLocal; + m_asset.Metadata.Temporary = tempFile; TransactionID = transaction; m_storeLocal = storeLocal; - + if (m_asset.Data.Length > 2) { SendCompleteMessage(); @@ -140,12 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction protected void RequestStartXfer() { XferID = Util.GetNextXferID(); - ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); + ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); } protected void SendCompleteMessage() { - ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); + ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID); m_finished = true; if (m_createItem) @@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction DateTime now = DateTime.Now; string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, - now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); + now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type); SaveAssetToFile(filename, m_asset.Data); } } @@ -196,9 +196,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction this.invType = invType; this.wearableType = wearableType; nextPerm = nextOwnerMask; - m_asset.Name = name; - m_asset.Description = description; - m_asset.Type = type; + m_asset.Metadata.Name = name; + m_asset.Metadata.Description = description; + m_asset.Metadata.Type = type; if (m_finished) { @@ -211,7 +211,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } } - + private void DoCreateItem() { m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); @@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction item.Owner = ourClient.AgentId; item.Creator = ourClient.AgentId; item.ID = UUID.Random(); - item.AssetID = m_asset.FullID; + item.AssetID = m_asset.Metadata.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; @@ -245,9 +245,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction else { m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", + "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", ourClient.AgentId); - } + } } /// @@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { return m_asset; } - + return null; } } diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs index a6901b6..f9a10bf 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender /// private AssetBase m_asset; - //public UUID assetID { get { return m_asset.FullID; } } + //public UUID assetID { get { return m_asset.Metadata.FullID; } } // private bool m_cancel = false; @@ -93,7 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_cancel = value; + // m_cancel = value; } } @@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_sending = value; + // m_sending = value; } } @@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender // See ITextureSender public bool SendTexturePacket() { - //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); + //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID); SendPacket(); counter++; @@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender { if (NumPackets == 0) { - RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); + RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); PacketCounter++; } else @@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); RequestUser.SendImageFirstPart( - (ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); + (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2); PacketCounter++; } } @@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender catch (ArgumentOutOfRangeException) { m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + - m_asset.FullID.ToString()); + m_asset.Metadata.ID); return; } - RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); + RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData); PacketCounter++; } } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 862caa9..dcfcba3 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver public class InventoryArchiveReadRequest { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected Scene scene; protected TarArchiveReader archive; private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); @@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver InventoryItemBase item = new InventoryItemBase(); StringReader sr = new StringReader(contents); XmlTextReader reader = new XmlTextReader(sr); - + if (contents.Equals("")) return null; reader.ReadStartElement("InventoryObject"); @@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver item.InvType = System.Convert.ToInt32(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreatorUUID"); - item.Creator = UUID.Parse(reader.ReadString()); + item.Creator = UUID.Parse(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreationDate"); item.CreationDate = System.Convert.ToInt32(reader.ReadString()); @@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver } else { - reader.ReadStartElement("Description"); + reader.ReadStartElement("Description"); item.Description = reader.ReadString(); reader.ReadEndElement(); } @@ -145,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver int successfulAssetRestores = 0; int failedAssetRestores = 0; int successfulItemRestores = 0; - + UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); if (null == userProfile) { @@ -157,28 +157,28 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver if (null == userInfo) { m_log.ErrorFormat( - "[CONSOLE]: Failed to find user info for {0} {1} {2}", + "[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; } - + if (!userInfo.HasReceivedInventory) { m_log.ErrorFormat( - "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", + "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; - } - + } + InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); if (null == inventoryFolder) { // TODO: Later on, automatically create this folder if it does not exist m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); - + return; } @@ -202,17 +202,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver else { InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); - - if (item != null) + + if (item != null) { item.Creator = userProfile.ID; item.Owner = userProfile.ID; - + // Reset folder ID to the one in which we want to load it // TODO: Properly restore entire folder structure. At the moment all items are dumped in this // single folder no matter where in the saved folder structure they are. item.Folder = inventoryFolder.ID; - + userInfo.AddItem(item); successfulItemRestores++; } @@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; scene.AssetCache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index 0974f02..bddf10d 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture // Create a new asset for user AssetBase asset = new AssetBase(); - asset.FullID = UUID.Random(); + asset.Metadata.FullID = UUID.Random(); asset.Data = assetData; - asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); - asset.Type = 0; - asset.Description = "dynamic image"; - asset.Local = false; - asset.Temporary = true; + asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); + asset.Metadata.Type = 0; + asset.Metadata.Description = "dynamic image"; + asset.Metadata.Local = false; + asset.Metadata.Temporary = true; scene.AssetCache.AddAsset(asset); - LastAssetID = asset.FullID; + LastAssetID = asset.Metadata.FullID; IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.syncdecode(asset.FullID, asset.Data); + cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data); } cacheLayerDecode = null; @@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture UUID oldID = tmptex.DefaultTexture.TextureID; scene.AssetCache.ExpireAsset(oldID); - tmptex.DefaultTexture.TextureID = asset.FullID; + tmptex.DefaultTexture.TextureID = asset.Metadata.FullID; // I'm pretty sure we always want to force this to true tmptex.DefaultTexture.Fullbright = true; @@ -287,7 +287,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture try { result = OpenJPEG.EncodeFromImage(joint, true); - } + } catch (Exception) { Console.WriteLine( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 4e9fcef..c860d01 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -66,12 +66,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); m_errorMessage = String.Empty; } - + public ArchiveReadRequest(Scene scene, Stream loadStream) { m_scene = scene; m_loadStream = loadStream; - } + } /// /// Dearchive the region embodied in this request. @@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions DearchiveRegion0DotStar(); } - + private void DearchiveRegion0DotStar() { int successfulAssetRestores = 0; @@ -98,12 +98,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver byte[] data; TarArchiveReader.TarEntryType entryType; - + while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { //m_log.DebugFormat( // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); - if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) + if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) { m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", filePath); @@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver LoadRegionSettings(filePath, data); } } - + //m_log.Debug("[ARCHIVER]: Reached end of archive"); archive.Close(); @@ -154,10 +154,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); } - + m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); m_scene.DeleteAllSceneObjects(); - + // Reload serialized prims m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); @@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // Try to retain the original creator/owner/lastowner if their uuid is present on this grid // otherwise, use the master avatar uuid instead UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; - + if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; - + foreach (SceneObjectPart part in sceneObject.Children.Values) { if (!resolveUserUuid(part.CreatorID)) @@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); } - + m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); } @@ -290,12 +290,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; m_scene.AssetCache.AddAsset(asset); - - /** + + /** * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so * it might be best done when dearchive takes place on a separate thread if (asset.Type=AssetType.Texture) @@ -317,7 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver return false; } } - + /// /// Load region settings data /// @@ -329,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver private bool LoadRegionSettings(string settingsPath, byte[] data) { RegionSettings loadedRegionSettings; - + try { loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); @@ -337,13 +337,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver catch (Exception e) { m_log.ErrorFormat( - "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", + "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", settingsPath, e); return false; } - + RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; - + currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; @@ -373,10 +373,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; - + IEstateModule estateModule = m_scene.RequestModuleInterface(); estateModule.sendRegionHandshakeToAll(); - + return true; } @@ -411,11 +411,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver if (File.Exists(path)) { return new FileStream(path, FileMode.Open); - } + } else { Uri uri = new Uri(path); // throw exception if not valid URI - if (uri.Scheme == "file") + if (uri.Scheme == "file") { return new FileStream(uri.AbsolutePath, FileMode.Open); } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs index 75ae474..36a60f3 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs @@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } xtw.WriteElementString("filename", uuid.ToString() + extension); - xtw.WriteElementString("name", asset.Name); - xtw.WriteElementString("description", asset.Description); - xtw.WriteElementString("asset-type", asset.Type.ToString()); + xtw.WriteElementString("name", asset.Metadata.Name); + xtw.WriteElementString("description", asset.Metadata.Description); + xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString()); xtw.WriteEndElement(); } @@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } else { m_log.ErrorFormat( "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", - asset.Type, asset.ID); + asset.Metadata.Type, asset.Metadata.ID); } archive.AddFile( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index b26fe4c..0ef1e1d 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs @@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); - asset.Description = metadata.Description; - asset.Type = metadata.AssetType; + asset.Metadata.Description = metadata.Description; + asset.Metadata.Type = metadata.AssetType; asset.Data = data; m_cache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs index 6d69443..2ba4e34 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs @@ -37,13 +37,13 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.World.Estate { - + public class EstateTerrainXferHandler { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private AssetBase m_asset; - + public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient); public event TerrainUploadComplete TerrainUploadDone; @@ -52,21 +52,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate //private string m_name = String.Empty; //private UUID TransactionID = UUID.Zero; private sbyte type = 0; - + public ulong mXferID; private TerrainUploadComplete handlerTerrainUploadDone; public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) { - + m_asset = new AssetBase(); - m_asset.FullID = UUID.Zero; - m_asset.Type = type; + m_asset.Metadata.FullID = UUID.Zero; + m_asset.Metadata.Type = type; m_asset.Data = new byte[0]; - m_asset.Name = pClientFilename; - m_asset.Description = "empty"; - m_asset.Local = true; - m_asset.Temporary = true; + m_asset.Metadata.Name = pClientFilename; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = true; + m_asset.Metadata.Temporary = true; } @@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void RequestStartXfer(IClientAPI pRemoteClient) { mXferID = Util.GetNextXferID(); - pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); } /// @@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate /// /// /// - /// + /// public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) { if (mXferID == xferID) @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate if ((packetID & 0x80000000) != 0) { SendCompleteMessage(remoteClient); - + } } } @@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate handlerTerrainUploadDone = TerrainUploadDone; if (handlerTerrainUploadDone != null) { - handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); + handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient); } } } diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs index 3acaa21..73a5a3a 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs @@ -1,29 +1,29 @@ /** * Copyright (c) 2008, Contributors. All rights reserved. * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without modification, + * + * 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, + * + * * 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 + * * 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 Organizations nor the names of Individual - * Contributors may be used to endorse or promote products derived from + * Contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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 + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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; @@ -48,7 +48,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Scenes.Hypergrid { - public class HGAssetMapper + public class HGAssetMapper { #region Fields private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -128,12 +128,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) { - m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); - // I think I need to store it in the asset DB too. + m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Metadata.Name + " " + assetID); + // I think I need to store it in the asset DB too. // For now, let me just do it for textures and scripts - if (((AssetType)asset.Type == AssetType.Texture) || - ((AssetType)asset.Type == AssetType.LSLBytecode) || - ((AssetType)asset.Type == AssetType.LSLText)) + if (((AssetType)asset.Metadata.Type == AssetType.Texture) || + ((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) || + ((AssetType)asset.Metadata.Type == AssetType.LSLText)) { AssetBase asset1 = new AssetBase(); Copy(asset, asset1); @@ -157,9 +157,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (asset1 != null) { // See long comment in AssetCache.AddAsset - if (!asset1.Temporary || asset1.Local) + if (!asset1.Metadata.Temporary || asset1.Metadata.Local) { - // The asset cache returns instances of subclasses of AssetBase: + // The asset cache returns instances of subclasses of AssetBase: // TextureImage or AssetInfo. So in passing them to the remote // server we first need to convert this to instances of AssetBase, // which is the serializable class for assets. @@ -179,14 +179,14 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid private void Copy(AssetBase from, AssetBase to) { to.Data = from.Data; - to.Description = from.Description; - to.FullID = from.FullID; - to.ID = from.ID; - to.Local = from.Local; - to.Name = from.Name; - to.Temporary = from.Temporary; - to.Type = from.Type; - + to.Metadata.Description = from.Metadata.Description; + to.Metadata.FullID = from.Metadata.FullID; + to.Metadata.ID = from.Metadata.ID; + to.Metadata.Local = from.Metadata.Local; + to.Metadata.Name = from.Metadata.Name; + to.Metadata.Temporary = from.Metadata.Temporary; + to.Metadata.Type = from.Metadata.Type; + } private void _guardedAdd(Dictionary lst, UUID obj, bool val) @@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid private Dictionary SniffUUIDs(AssetBase asset) { Dictionary uuids = new Dictionary(); - if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) + if ((asset != null) && ((AssetType)asset.Metadata.Type == AssetType.Object)) { string ass_str = Utils.BytesToString(asset.Data); SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 58ab058..cb9aee2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -42,12 +42,12 @@ namespace OpenSim.Region.Environment.Scenes public partial class Scene { private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Allows asynchronous derezzing of objects from the scene into a client's inventory. /// - protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; + protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; /// /// Start all the scripts in the scene which should be started. @@ -145,9 +145,9 @@ namespace OpenSim.Region.Environment.Scenes else { m_log.ErrorFormat( - "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", + "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", remoteClient.AgentId); - } + } } /// @@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); return UUID.Zero; } - + remoteClient.SendAgentAlertMessage("Notecard saved", false); } else if ((InventoryType)item.InvType == InventoryType.LSL) @@ -185,7 +185,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); return UUID.Zero; } - + remoteClient.SendAgentAlertMessage("Script saved", false); } @@ -193,21 +193,21 @@ namespace OpenSim.Region.Environment.Scenes CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); AssetCache.AddAsset(asset); - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; userInfo.UpdateItem(item); // remoteClient.SendInventoryItemCreateUpdate(item); - return (asset.FullID); + return (asset.Metadata.FullID); } } } else { m_log.ErrorFormat( - "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", + "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", remoteClient.AgentId); - } - + } + return UUID.Zero; } @@ -283,9 +283,9 @@ namespace OpenSim.Region.Environment.Scenes { part.Inventory.RemoveScriptInstance(item.ItemID); } - + // Update item with new asset - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; group.UpdateInventoryItem(item); part.GetProperties(remoteClient); @@ -406,7 +406,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// ID of the sender of the item - /// + /// public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) { InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); @@ -420,19 +420,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// ID of the sender of the item - /// + /// /// The inventory item copy given, null if the give was unsuccessful public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) { return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); } - + /// /// Give an inventory item from one user to another /// /// /// ID of the sender of the item - /// + /// /// /// The id of the folder in which the copy item should go. If UUID.Zero then the item is placed in the most /// appropriate default folder. @@ -485,7 +485,7 @@ namespace OpenSim.Region.Environment.Scenes itemCopy.AssetType = item.AssetType; itemCopy.InvType = item.InvType; itemCopy.Folder = recipientFolderId; - + if (Permissions.PropagatePermissions()) { if (item.InvType == 6) @@ -557,19 +557,19 @@ namespace OpenSim.Region.Environment.Scenes m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); return null; } - + return null; } - + /// - /// Give an entire inventory folder from one user to another. The entire contents (including all descendent + /// Give an entire inventory folder from one user to another. The entire contents (including all descendent /// folders) is given. /// /// /// ID of the sender of the item /// /// - /// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the + /// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the /// recipient folder is the root folder /// /// @@ -588,24 +588,24 @@ namespace OpenSim.Region.Environment.Scenes return null; } - + if (!senderUserInfo.HasReceivedInventory) { m_log.DebugFormat( "[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}", senderId); - + return null; } - + InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId); - + if (null == folder) { m_log.ErrorFormat( "[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId); - return null; + return null; } CachedUserInfo recipientUserInfo @@ -618,30 +618,30 @@ namespace OpenSim.Region.Environment.Scenes return null; } - + if (recipientParentFolderId == UUID.Zero) recipientParentFolderId = recipientUserInfo.RootFolder.ID; - + UUID newFolderId = UUID.Random(); recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId); - + // XXX: Messy - we should really get this back in the CreateFolder call InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId); - + // Give all the subfolders List subFolders = folder.RequestListOfFolderImpls(); foreach (InventoryFolderImpl childFolder in subFolders) { GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID); - } - + } + // Give all the items List items = folder.RequestListOfItems(); foreach (InventoryItemBase item in items) { GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID); } - + return copiedFolder; } @@ -688,7 +688,7 @@ namespace OpenSim.Region.Environment.Scenes { if (newName != String.Empty) { - asset.Name = newName; + asset.Metadata.Name = newName; } else { @@ -728,10 +728,10 @@ namespace OpenSim.Region.Environment.Scenes private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) { AssetBase asset = new AssetBase(); - asset.Name = name; - asset.Description = description; - asset.Type = assetType; - asset.FullID = UUID.Random(); + asset.Metadata.Name = name; + asset.Metadata.Description = description; + asset.Metadata.Type = assetType; + asset.Metadata.FullID = UUID.Random(); asset.Data = (data == null) ? new byte[1] : data; return asset; @@ -831,11 +831,11 @@ namespace OpenSim.Region.Environment.Scenes item.Owner = remoteClient.AgentId; item.Creator = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.FullID; - item.Description = asset.Description; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; item.Name = name; item.Flags = flags; - item.AssetType = asset.Type; + item.AssetType = asset.Metadata.Type; item.InvType = invType; item.Folder = folderID; item.CurrentPermissions = currentMask; @@ -879,7 +879,7 @@ namespace OpenSim.Region.Environment.Scenes if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; - + if (transactionID == UUID.Zero) { CachedUserInfo userInfo @@ -890,7 +890,7 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence presence; TryGetAvatar(remoteClient.AgentId, out presence); byte[] data = null; - + if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum { Vector3 pos = presence.AbsolutePosition; @@ -905,7 +905,7 @@ namespace OpenSim.Region.Environment.Scenes AssetBase asset = CreateAsset(name, description, assetType, data); AssetCache.AddAsset(asset); - CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); + CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); } else { @@ -1429,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes } } else // Updating existing item with new perms etc - { + { IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); if (agentTransactions != null) { @@ -1511,7 +1511,7 @@ namespace OpenSim.Region.Environment.Scenes } } else // script has been rezzed directly into a prim's inventory - { + { SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); if (part == null) return; @@ -1521,10 +1521,10 @@ namespace OpenSim.Region.Environment.Scenes if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) return; - + if (!Permissions.CanCreateObjectInventory( - itemBase.InvType, part.UUID, remoteClient.AgentId)) - return; + itemBase.InvType, part.UUID, remoteClient.AgentId)) + return; AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); AssetCache.AddAsset(asset); @@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes taskItem.Flags = itemBase.Flags; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; - taskItem.AssetID = asset.FullID; + taskItem.AssetID = asset.Metadata.FullID; part.Inventory.AddInventoryItem(taskItem, false); part.GetProperties(remoteClient); @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Environment.Scenes grp.UUID, remoteClient.AgentId); permissionToDelete = permissionToTake; - + if (permissionToDelete) { AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); @@ -1794,8 +1794,8 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// - /// + /// + /// public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { @@ -1807,7 +1807,7 @@ namespace OpenSim.Region.Environment.Scenes // CachedUserInfo userInfo; - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || action == DeRezAction.SaveToExistingUserInventoryItem) { // Take or take copy require a taker @@ -1850,25 +1850,25 @@ namespace OpenSim.Region.Environment.Scenes // InventoryFolderBase folder = null; - InventoryItemBase item = null; + InventoryItemBase item = null; if (DeRezAction.SaveToExistingUserInventoryItem == action) { item = userInfo.RootFolder.FindItem( objectGroup.RootPart.FromUserInventoryItemID); - + if (null == item) { m_log.DebugFormat( - "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", - objectGroup.Name, objectGroup.UUID); + "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", + objectGroup.Name, objectGroup.UUID); return UUID.Zero; } } else { // Folder magic - // + // if (action == DeRezAction.Delete) { // Deleting someone else's item @@ -1940,7 +1940,7 @@ namespace OpenSim.Region.Environment.Scenes item.InvType = (int)InventoryType.Object; item.Folder = folder.ID; item.Owner = userInfo.UserProfile.ID; - + } AssetBase asset = CreateAsset( @@ -1949,16 +1949,16 @@ namespace OpenSim.Region.Environment.Scenes (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); AssetCache.AddAsset(asset); - assetID = asset.FullID; - + assetID = asset.Metadata.FullID; + if (DeRezAction.SaveToExistingUserInventoryItem == action) - { - item.AssetID = asset.FullID; + { + item.AssetID = asset.Metadata.FullID; userInfo.UpdateItem(item); } else { - item.AssetID = asset.FullID; + item.AssetID = asset.Metadata.FullID; if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) { @@ -1991,12 +1991,12 @@ namespace OpenSim.Region.Environment.Scenes // TODO: add the new fields (Flags, Sale info, etc) item.CreationDate = Util.UnixTimeSinceEpoch(); - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; userInfo.AddItem(item); - + if (remoteClient != null && item.Owner == remoteClient.AgentId) { remoteClient.SendInventoryItemCreateUpdate(item); @@ -2008,10 +2008,10 @@ namespace OpenSim.Region.Environment.Scenes { notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); } - } + } } } - + return assetID; } @@ -2025,11 +2025,11 @@ namespace OpenSim.Region.Environment.Scenes m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID); return; } - + m_log.InfoFormat( - "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", + "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", grp.UUID, grp.GetAttachmentPoint()); - + string sceneObjectXml = objectGroup.ToXmlString(); CachedUserInfo userInfo = @@ -2077,10 +2077,10 @@ namespace OpenSim.Region.Environment.Scenes Utils.StringToBytes(sceneObjectXml)); AssetCache.AddAsset(asset); - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = foundFolder; @@ -2118,10 +2118,10 @@ namespace OpenSim.Region.Environment.Scenes item.Creator = grp.RootPart.CreatorID; item.Owner = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = UUID.Zero; // Objects folder! @@ -2241,20 +2241,20 @@ namespace OpenSim.Region.Environment.Scenes if (rezAsset != null) { UUID itemId = UUID.Zero; - + // If we have permission to copy then link the rezzed object back to the user inventory // item that it came from. This allows us to enable 'save object to inventory' if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) - { + { itemId = item.ID; } } - + string xmlData = Utils.BytesToString(rezAsset.Data); SceneObjectGroup group = new SceneObjectGroup(itemId, xmlData, true); - + if (!Permissions.CanRezObject( group.Children.Count, remoteClient.AgentId, pos) && !attachment) @@ -2351,12 +2351,12 @@ namespace OpenSim.Region.Environment.Scenes group.ClearPartAttachmentData(); } } - + if (!attachment) { // Fire on_rez group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); - + rootPart.ScheduleFullUpdate(); } @@ -2500,7 +2500,7 @@ namespace OpenSim.Region.Environment.Scenes DeRezObject(null, grp.RootPart.LocalId, grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); } - + return true; } @@ -2632,7 +2632,7 @@ namespace OpenSim.Region.Environment.Scenes } } - + m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 33dae66..32bd9aa 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -115,18 +115,18 @@ namespace OpenSim.Region.Environment.Scenes /// /// All the region modules attached to this scene. - /// + /// public Dictionary Modules { get { return m_modules; } } protected Dictionary m_modules = new Dictionary(); - + /// /// The module interfaces available from this scene. /// protected Dictionary > ModuleInterfaces = new Dictionary >(); - + protected Dictionary ModuleAPIMethods = new Dictionary(); protected Dictionary m_moduleCommanders = new Dictionary(); @@ -143,7 +143,7 @@ namespace OpenSim.Region.Environment.Scenes protected IInterregionCommsIn m_interregionCommsIn; protected IDialogModule m_dialogModule; protected internal ICapabilitiesModule CapsModule; - + // Central Update Loop protected int m_fps = 10; @@ -280,10 +280,10 @@ namespace OpenSim.Region.Environment.Scenes } public int objectCapacity = 45000; - + /// /// Registered classes that are capable of creating entities. - /// + /// protected Dictionary m_entityCreators = new Dictionary(); #endregion @@ -316,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); - + m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; @@ -421,7 +421,7 @@ namespace OpenSim.Region.Environment.Scenes protected virtual void RegisterDefaultSceneEvents() { IDialogModule dm = RequestModuleInterface(); - + if (dm != null) m_eventManager.OnPermissionError += dm.SendAlertToUser; } @@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes m_incrementsof15seconds = (int)seconds / 15; m_RestartTimerCounter = 0; m_restartTimer.AutoReset = true; - m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); + m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_restartTimer.Start(); m_dialogModule.SendNotificationToUsersInRegion( @@ -583,8 +583,8 @@ namespace OpenSim.Region.Environment.Scenes { if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) m_dialogModule.SendNotificationToUsersInRegion( - UUID.Random(), - String.Empty, + UUID.Random(), + String.Empty, RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds"); } else @@ -717,7 +717,7 @@ namespace OpenSim.Region.Environment.Scenes // Stop all client threads. ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); }); - + // Stop updating the scene objects and agents. //m_heartbeatTimer.Close(); shuttingdown = true; @@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes } m_sceneGraph.Close(); - + // De-register with region communications (events cleanup) UnRegisterRegionWithComms(); @@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes //tc = System.Environment.TickCount - tc; //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); } - + m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (System.Environment.TickCount - tc) + " ms"); bool drawPrimVolume = true; @@ -1644,13 +1644,13 @@ namespace OpenSim.Region.Environment.Scenes m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID; AssetBase asset = new AssetBase(); - asset.FullID = m_regInfo.RegionSettings.TerrainImageID; + asset.Metadata.FullID = m_regInfo.RegionSettings.TerrainImageID; asset.Data = data; - asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); - asset.Description = RegionInfo.RegionName; + asset.Metadata.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); + asset.Metadata.Description = RegionInfo.RegionName; - asset.Type = 0; - asset.Temporary = temporary; + asset.Metadata.Type = 0; + asset.Metadata.Temporary = temporary; AssetCache.AddAsset(asset); } @@ -1699,7 +1699,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", group.Children == null ? 0 : group.Children.Count); } - + AddRestoredSceneObject(group, true, true); SceneObjectPart rootPart = group.GetChildPart(group.UUID); rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; @@ -1814,7 +1814,7 @@ namespace OpenSim.Region.Environment.Scenes { //m_log.DebugFormat( // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); - + // If an entity creator has been registered for this prim type then use that if (m_entityCreators.ContainsKey((PCode)shape.PCode)) return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape); @@ -2094,7 +2094,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) { - + if (XMLMethod == 0) { m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); @@ -2308,7 +2308,7 @@ namespace OpenSim.Region.Environment.Scenes CreateAndAddScenePresence(client); } - + m_LastLogin = System.Environment.TickCount; EventManager.TriggerOnNewClient(client); } @@ -2390,7 +2390,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnUnackedTerrain += TerrainUnAcked; client.OnObjectOwner += ObjectOwner; - + if (StatsReporter != null) client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; @@ -2561,7 +2561,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}", client.Name, e); } - + m_log.Warn("[APPEARANCE]: Appearance not found, returning default"); } @@ -2770,21 +2770,21 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); if (sp != null) - { + { m_log.DebugFormat( - "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", + "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", agent.AgentID, RegionInfo.RegionName); - + sp.AdjustKnownSeeds(); - + return; } - + // Don't disable this log message - it's too helpful m_log.DebugFormat( - "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", + "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); - + if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) { m_log.WarnFormat( @@ -2808,10 +2808,10 @@ namespace OpenSim.Region.Environment.Scenes } m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - + // rewrite session_id CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); - + if (userinfo != null) { userinfo.SessionID = agent.SessionID; @@ -2873,12 +2873,12 @@ namespace OpenSim.Region.Environment.Scenes public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { ScenePresence presence; - + lock (m_scenePresences) { m_scenePresences.TryGetValue(agentID, out presence); } - + if (presence != null) { try @@ -2902,14 +2902,14 @@ namespace OpenSim.Region.Environment.Scenes { // m_log.DebugFormat( // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); - + ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } - + return false; } @@ -2932,10 +2932,10 @@ namespace OpenSim.Region.Environment.Scenes // Not Implemented: //TODO: Do we need to pass the message on to one of our neighbors? } - + return true; } - + return false; } @@ -2957,7 +2957,7 @@ namespace OpenSim.Region.Environment.Scenes public bool IncomingCloseAgent(UUID agentID) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); - + ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { @@ -2972,7 +2972,7 @@ namespace OpenSim.Region.Environment.Scenes } // Don't do this to root agents on logout, it's not nice for the viewer - if (presence.IsChildAgent) + if (presence.IsChildAgent) { // Tell a single agent to disconnect from the region. IEventQueue eq = RequestModuleInterface(); @@ -2984,11 +2984,11 @@ namespace OpenSim.Region.Environment.Scenes else presence.ControllingClient.SendShutdownConnectionNotice(); } - + presence.ControllingClient.Close(true); return true; } - + // Agent not here return false; } @@ -3059,7 +3059,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); return; } - + RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); } @@ -3080,7 +3080,7 @@ namespace OpenSim.Region.Environment.Scenes if (m_scenePresences.ContainsKey(remoteClient.AgentId)) sp = m_scenePresences[remoteClient.AgentId]; } - + if (sp != null) { m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, @@ -3211,7 +3211,7 @@ namespace OpenSim.Region.Environment.Scenes return; l.Add(mod); - + if (mod is IEntityCreator) { IEntityCreator entityCreator = (IEntityCreator)mod; @@ -3220,7 +3220,7 @@ namespace OpenSim.Region.Environment.Scenes m_entityCreators[pcode] = entityCreator; } } - + ModuleInterfaces[typeof(M)] = l; } @@ -3243,7 +3243,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// For the given interface, retrieve an array of region modules that implement it. /// - /// an empty array if there are no registered modules implementing that interface + /// an empty array if there are no registered modules implementing that interface public override T[] RequestModuleInterfaces() { if (ModuleInterfaces.ContainsKey(typeof(T))) @@ -3383,7 +3383,7 @@ namespace OpenSim.Region.Environment.Scenes else { m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); - } + } } } @@ -3855,14 +3855,14 @@ namespace OpenSim.Region.Environment.Scenes public override bool PresenceChildStatus(UUID avatarID) { ScenePresence cp = GetScenePresence(avatarID); - + // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing // This needs to be fixed properly by cleaning up the logout code. //if (cp != null) // return cp.IsChildAgent; - + //return false; - + return cp.IsChildAgent; } @@ -4140,10 +4140,10 @@ namespace OpenSim.Region.Environment.Scenes item.ID = UUID.Random(); item.Owner = remoteClient.AgentId; - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + item.AssetID = asset.Metadata.FullID; + item.Description = asset.Metadata.Description; + item.Name = asset.Metadata.Name; + item.AssetType = asset.Metadata.Type; item.InvType = (int)InventoryType.Object; item.Folder = categoryID; @@ -4194,7 +4194,7 @@ namespace OpenSim.Region.Environment.Scenes if (!okToSell) { m_dialogModule.SendAlertToUser( - remoteClient, "This item's inventory doesn't appear to be for sale"); + remoteClient, "This item's inventory doesn't appear to be for sale"); return false; } @@ -4252,7 +4252,7 @@ namespace OpenSim.Region.Environment.Scenes // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called - // from within the OdePhysicsScene. + // from within the OdePhysicsScene. protected internal void jointMoved(PhysicsJoint joint) { @@ -4348,7 +4348,7 @@ namespace OpenSim.Region.Environment.Scenes // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary if (joint != null) { - if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) + if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) return; SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); -- cgit v1.1