diff options
author | John Hurliman | 2009-11-05 13:10:58 -0800 |
---|---|---|
committer | John Hurliman | 2009-11-05 13:10:58 -0800 |
commit | afef1ac191d32e9c1514c294b17e404b1d4ae217 (patch) | |
tree | c390ef81c9c30922c2e95e32844832919884fd9c | |
parent | Applying #4332, optional packet statistics logging (diff) | |
download | opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.zip opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.gz opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.bz2 opensim-SC_OLD-afef1ac191d32e9c1514c294b17e404b1d4ae217.tar.xz |
Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen
31 files changed, 105 insertions, 122 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3c7727f..3149eaa 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1562,11 +1562,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1562 | assets = doc.GetElementsByTagName("RequiredAsset"); | 1562 | assets = doc.GetElementsByTagName("RequiredAsset"); |
1563 | foreach (XmlNode asset in assets) | 1563 | foreach (XmlNode asset in assets) |
1564 | { | 1564 | { |
1565 | AssetBase rass = new AssetBase(); | 1565 | AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); |
1566 | rass.FullID = UUID.Random(); | ||
1567 | rass.Name = GetStringAttribute(asset,"name",""); | ||
1568 | rass.Description = GetStringAttribute(asset,"desc",""); | 1566 | rass.Description = GetStringAttribute(asset,"desc",""); |
1569 | rass.Type = SByte.Parse(GetStringAttribute(asset,"type","")); | ||
1570 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); | 1567 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); |
1571 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); | 1568 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); |
1572 | rass.Data = Convert.FromBase64String(asset.InnerText); | 1569 | rass.Data = Convert.FromBase64String(asset.InnerText); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index f862af1..66572d5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | |||
@@ -261,11 +261,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
261 | modified = (asset != null); | 261 | modified = (asset != null); |
262 | created = !modified; | 262 | created = !modified; |
263 | 263 | ||
264 | asset = new AssetBase(); | 264 | asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); |
265 | asset.FullID = uuid; | ||
266 | asset.Name = xml.GetAttribute("name"); | ||
267 | asset.Description = xml.GetAttribute("desc"); | 265 | asset.Description = xml.GetAttribute("desc"); |
268 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | ||
269 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 266 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
270 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 267 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
271 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 268 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); |
@@ -341,11 +338,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
341 | modified = (asset != null); | 338 | modified = (asset != null); |
342 | created = !modified; | 339 | created = !modified; |
343 | 340 | ||
344 | asset = new AssetBase(); | 341 | asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); |
345 | asset.FullID = uuid; | ||
346 | asset.Name = xml.GetAttribute("name"); | ||
347 | asset.Description = xml.GetAttribute("desc"); | 342 | asset.Description = xml.GetAttribute("desc"); |
348 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | ||
349 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 343 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
350 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 344 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
351 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 345 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 4e03e67..01bfe00 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -1869,10 +1869,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1869 | 1869 | ||
1870 | // Create AssetBase entity to hold the inlined asset | 1870 | // Create AssetBase entity to hold the inlined asset |
1871 | 1871 | ||
1872 | asset = new AssetBase(uuid, name); | 1872 | asset = new AssetBase(uuid, name, type); |
1873 | 1873 | ||
1874 | asset.Description = desc; | 1874 | asset.Description = desc; |
1875 | asset.Type = type; // type == 0 == texture | ||
1876 | asset.Local = local; | 1875 | asset.Local = local; |
1877 | asset.Temporary = temp; | 1876 | asset.Temporary = temp; |
1878 | 1877 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 25f7cf0..1ce4abf 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -132,12 +132,13 @@ namespace OpenSim.Data.MSSQL | |||
132 | { | 132 | { |
133 | if (reader.Read()) | 133 | if (reader.Read()) |
134 | { | 134 | { |
135 | AssetBase asset = new AssetBase(); | 135 | AssetBase asset = new AssetBase( |
136 | new UUID((Guid)reader["id"]), | ||
137 | (string)reader["name"], | ||
138 | Convert.ToSByte(reader["assetType"]) | ||
139 | ); | ||
136 | // Region Main | 140 | // Region Main |
137 | asset.FullID = new UUID((Guid)reader["id"]); | ||
138 | asset.Name = (string)reader["name"]; | ||
139 | asset.Description = (string)reader["description"]; | 141 | asset.Description = (string)reader["description"]; |
140 | asset.Type = Convert.ToSByte(reader["assetType"]); | ||
141 | asset.Local = Convert.ToBoolean(reader["local"]); | 142 | asset.Local = Convert.ToBoolean(reader["local"]); |
142 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); | 143 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); |
143 | asset.Data = (byte[])reader["data"]; | 144 | asset.Data = (byte[])reader["data"]; |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 1fe6d29..6a4ccd7 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -151,10 +151,9 @@ namespace OpenSim.Data.MySQL | |||
151 | { | 151 | { |
152 | if (dbReader.Read()) | 152 | if (dbReader.Read()) |
153 | { | 153 | { |
154 | asset = new AssetBase(); | 154 | asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"]); |
155 | asset.Data = (byte[]) dbReader["data"]; | 155 | asset.Data = (byte[]) dbReader["data"]; |
156 | asset.Description = (string) dbReader["description"]; | 156 | asset.Description = (string) dbReader["description"]; |
157 | asset.FullID = assetID; | ||
158 | 157 | ||
159 | string local = dbReader["local"].ToString(); | 158 | string local = dbReader["local"].ToString(); |
160 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) | 159 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) |
@@ -162,8 +161,6 @@ namespace OpenSim.Data.MySQL | |||
162 | else | 161 | else |
163 | asset.Local = false; | 162 | asset.Local = false; |
164 | 163 | ||
165 | asset.Name = (string) dbReader["name"]; | ||
166 | asset.Type = (sbyte) dbReader["assetType"]; | ||
167 | asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); | 164 | asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); |
168 | } | 165 | } |
169 | dbReader.Close(); | 166 | dbReader.Close(); |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 49275cb..11be28e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -231,12 +231,13 @@ namespace OpenSim.Data.SQLite | |||
231 | // TODO: this doesn't work yet because something more | 231 | // TODO: this doesn't work yet because something more |
232 | // interesting has to be done to actually get these values | 232 | // interesting has to be done to actually get these values |
233 | // back out. Not enough time to figure it out yet. | 233 | // back out. Not enough time to figure it out yet. |
234 | AssetBase asset = new AssetBase(); | 234 | AssetBase asset = new AssetBase( |
235 | new UUID((String)row["UUID"]), | ||
236 | (String)row["Name"], | ||
237 | Convert.ToSByte(row["Type"]) | ||
238 | ); | ||
235 | 239 | ||
236 | asset.FullID = new UUID((String) row["UUID"]); | ||
237 | asset.Name = (String) row["Name"]; | ||
238 | asset.Description = (String) row["Description"]; | 240 | asset.Description = (String) row["Description"]; |
239 | asset.Type = Convert.ToSByte(row["Type"]); | ||
240 | asset.Local = Convert.ToBoolean(row["Local"]); | 241 | asset.Local = Convert.ToBoolean(row["Local"]); |
241 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); | 242 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); |
242 | asset.Data = (byte[]) row["Data"]; | 243 | asset.Data = (byte[]) row["Data"]; |
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 1969d76..25aed61 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -66,9 +66,9 @@ namespace OpenSim.Data.Tests | |||
66 | [Test] | 66 | [Test] |
67 | public void T010_StoreSimpleAsset() | 67 | public void T010_StoreSimpleAsset() |
68 | { | 68 | { |
69 | AssetBase a1 = new AssetBase(uuid1, "asset one"); | 69 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
70 | AssetBase a2 = new AssetBase(uuid2, "asset two"); | 70 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture); |
71 | AssetBase a3 = new AssetBase(uuid3, "asset three"); | 71 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture); |
72 | a1.Data = asset1; | 72 | a1.Data = asset1; |
73 | a2.Data = asset1; | 73 | a2.Data = asset1; |
74 | a3.Data = asset1; | 74 | a3.Data = asset1; |
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs index 06ca53e..5b1f935 100644 --- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs +++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs | |||
@@ -297,8 +297,8 @@ namespace OpenSim.Data.Tests | |||
297 | public void AssetShouldMatch() | 297 | public void AssetShouldMatch() |
298 | { | 298 | { |
299 | UUID uuid1 = UUID.Random(); | 299 | UUID uuid1 = UUID.Random(); |
300 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 300 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
301 | AssetBase expected = new AssetBase(uuid1, "asset one"); | 301 | AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
302 | 302 | ||
303 | var constraint = Constraints.PropertyCompareConstraint(expected); | 303 | var constraint = Constraints.PropertyCompareConstraint(expected); |
304 | 304 | ||
@@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests | |||
309 | public void AssetShouldNotMatch() | 309 | public void AssetShouldNotMatch() |
310 | { | 310 | { |
311 | UUID uuid1 = UUID.Random(); | 311 | UUID uuid1 = UUID.Random(); |
312 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 312 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
313 | AssetBase expected = new AssetBase(UUID.Random(), "asset one"); | 313 | AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); |
314 | 314 | ||
315 | var constraint = Constraints.PropertyCompareConstraint(expected); | 315 | var constraint = Constraints.PropertyCompareConstraint(expected); |
316 | 316 | ||
@@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests | |||
321 | public void AssetShouldNotMatch2() | 321 | public void AssetShouldNotMatch2() |
322 | { | 322 | { |
323 | UUID uuid1 = UUID.Random(); | 323 | UUID uuid1 = UUID.Random(); |
324 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 324 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
325 | AssetBase expected = new AssetBase(uuid1, "asset two"); | 325 | AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture); |
326 | 326 | ||
327 | var constraint = Constraints.PropertyCompareConstraint(expected); | 327 | var constraint = Constraints.PropertyCompareConstraint(expected); |
328 | 328 | ||
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index 72aaff1..c968364 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs | |||
@@ -165,7 +165,7 @@ namespace OpenSim.Data.Tests | |||
165 | [Test] | 165 | [Test] |
166 | public void TestScramble() | 166 | public void TestScramble() |
167 | { | 167 | { |
168 | AssetBase actual = new AssetBase(UUID.Random(), "asset one"); | 168 | AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); |
169 | new PropertyScrambler<AssetBase>().Scramble(actual); | 169 | new PropertyScrambler<AssetBase>().Scramble(actual); |
170 | } | 170 | } |
171 | 171 | ||
@@ -173,8 +173,7 @@ namespace OpenSim.Data.Tests | |||
173 | public void DontScramble() | 173 | public void DontScramble() |
174 | { | 174 | { |
175 | UUID uuid = UUID.Random(); | 175 | UUID uuid = UUID.Random(); |
176 | AssetBase asset = new AssetBase(); | 176 | AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture); |
177 | asset.FullID = uuid; | ||
178 | new PropertyScrambler<AssetBase>() | 177 | new PropertyScrambler<AssetBase>() |
179 | .DontScramble(x => x.Metadata) | 178 | .DontScramble(x => x.Metadata) |
180 | .DontScramble(x => x.FullID) | 179 | .DontScramble(x => x.FullID) |
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 9679ff2..eed9703 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Xml.Serialization; | 29 | using System.Xml.Serialization; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | 33 | ||
32 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
@@ -37,6 +39,8 @@ namespace OpenSim.Framework | |||
37 | [Serializable] | 39 | [Serializable] |
38 | public class AssetBase | 40 | public class AssetBase |
39 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
40 | /// <summary> | 44 | /// <summary> |
41 | /// Data of the Asset | 45 | /// Data of the Asset |
42 | /// </summary> | 46 | /// </summary> |
@@ -47,16 +51,34 @@ namespace OpenSim.Framework | |||
47 | /// </summary> | 51 | /// </summary> |
48 | private AssetMetadata m_metadata; | 52 | private AssetMetadata m_metadata; |
49 | 53 | ||
50 | public AssetBase() | 54 | public AssetBase(UUID assetID, string name, sbyte assetType) |
51 | { | 55 | { |
56 | if (assetType == (sbyte)AssetType.Unknown) | ||
57 | { | ||
58 | System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true); | ||
59 | m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}", | ||
60 | name, assetID, trace.ToString()); | ||
61 | } | ||
62 | |||
52 | m_metadata = new AssetMetadata(); | 63 | m_metadata = new AssetMetadata(); |
64 | m_metadata.FullID = assetID; | ||
65 | m_metadata.Name = name; | ||
66 | m_metadata.Type = assetType; | ||
53 | } | 67 | } |
54 | 68 | ||
55 | public AssetBase(UUID assetId, string name) | 69 | public AssetBase(string assetID, string name, sbyte assetType) |
56 | { | 70 | { |
71 | if (assetType == (sbyte)AssetType.Unknown) | ||
72 | { | ||
73 | System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true); | ||
74 | m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}", | ||
75 | name, assetID, trace.ToString()); | ||
76 | } | ||
77 | |||
57 | m_metadata = new AssetMetadata(); | 78 | m_metadata = new AssetMetadata(); |
58 | m_metadata.FullID = assetId; | 79 | m_metadata.ID = assetID; |
59 | m_metadata.Name = name; | 80 | m_metadata.Name = name; |
81 | m_metadata.Type = assetType; | ||
60 | } | 82 | } |
61 | 83 | ||
62 | public bool ContainsReferences | 84 | public bool ContainsReferences |
@@ -193,11 +215,11 @@ namespace OpenSim.Framework | |||
193 | private string m_name = String.Empty; | 215 | private string m_name = String.Empty; |
194 | private string m_description = String.Empty; | 216 | private string m_description = String.Empty; |
195 | private DateTime m_creation_date; | 217 | private DateTime m_creation_date; |
196 | private sbyte m_type; | 218 | private sbyte m_type = (sbyte)AssetType.Unknown; |
197 | private string m_content_type; | 219 | private string m_content_type; |
198 | private byte[] m_sha1; | 220 | private byte[] m_sha1; |
199 | private bool m_local = false; | 221 | private bool m_local; |
200 | private bool m_temporary = false; | 222 | private bool m_temporary; |
201 | //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); | 223 | //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); |
202 | //private OSDMap m_extra_data; | 224 | //private OSDMap m_extra_data; |
203 | 225 | ||
@@ -211,7 +233,13 @@ namespace OpenSim.Framework | |||
211 | { | 233 | { |
212 | //get { return m_fullid.ToString(); } | 234 | //get { return m_fullid.ToString(); } |
213 | //set { m_fullid = new UUID(value); } | 235 | //set { m_fullid = new UUID(value); } |
214 | get { return m_id; } | 236 | get |
237 | { | ||
238 | if (String.IsNullOrEmpty(m_id)) | ||
239 | m_id = m_fullid.ToString(); | ||
240 | |||
241 | return m_id; | ||
242 | } | ||
215 | set | 243 | set |
216 | { | 244 | { |
217 | UUID uuid = UUID.Zero; | 245 | UUID uuid = UUID.Zero; |
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index fd7a2cd..058b442 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs | |||
@@ -38,11 +38,9 @@ namespace OpenSim.Framework | |||
38 | public int Version; | 38 | public int Version; |
39 | 39 | ||
40 | public AssetLandmark(AssetBase a) | 40 | public AssetLandmark(AssetBase a) |
41 | : base(a.FullID, a.Name, a.Type) | ||
41 | { | 42 | { |
42 | Data = a.Data; | 43 | Data = a.Data; |
43 | FullID = a.FullID; | ||
44 | Type = a.Type; | ||
45 | Name = a.Name; | ||
46 | Description = a.Description; | 44 | Description = a.Description; |
47 | InternData(); | 45 | InternData(); |
48 | } | 46 | } |
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index a394b1a..9497a2e 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | |||
@@ -43,18 +43,15 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected static AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage) | 46 | protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) |
47 | { | 47 | { |
48 | AssetBase asset = new AssetBase( | 48 | AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type); |
49 | new UUID(assetIdStr), | ||
50 | name | ||
51 | ); | ||
52 | 49 | ||
53 | if (!String.IsNullOrEmpty(path)) | 50 | if (!String.IsNullOrEmpty(path)) |
54 | { | 51 | { |
55 | //m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path); | 52 | //m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path); |
56 | 53 | ||
57 | LoadAsset(asset, isImage, path); | 54 | LoadAsset(asset, path); |
58 | } | 55 | } |
59 | else | 56 | else |
60 | { | 57 | { |
@@ -64,8 +61,14 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
64 | return asset; | 61 | return asset; |
65 | } | 62 | } |
66 | 63 | ||
67 | protected static void LoadAsset(AssetBase info, bool image, string path) | 64 | protected static void LoadAsset(AssetBase info, string path) |
68 | { | 65 | { |
66 | bool image = | ||
67 | (info.Type == (sbyte)AssetType.Texture || | ||
68 | info.Type == (sbyte)AssetType.TextureTGA || | ||
69 | info.Type == (sbyte)AssetType.ImageJPEG || | ||
70 | info.Type == (sbyte)AssetType.ImageTGA); | ||
71 | |||
69 | FileInfo fInfo = new FileInfo(path); | 72 | FileInfo fInfo = new FileInfo(path); |
70 | long numBytes = fInfo.Length; | 73 | long numBytes = fInfo.Length; |
71 | if (fInfo.Exists) | 74 | if (fInfo.Exists) |
@@ -138,10 +141,10 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
138 | { | 141 | { |
139 | string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); | 142 | string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); |
140 | string name = source.Configs[i].GetString("name", String.Empty); | 143 | string name = source.Configs[i].GetString("name", String.Empty); |
141 | sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); | 144 | sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); |
142 | string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty)); | 145 | string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty)); |
143 | 146 | ||
144 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); | 147 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, type); |
145 | 148 | ||
146 | newAsset.Type = type; | 149 | newAsset.Type = type; |
147 | assets.Add(newAsset); | 150 | assets.Add(newAsset); |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index ccfe800..72231ca 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -888,10 +888,7 @@ namespace OpenSim.Framework.Capabilities | |||
888 | } | 888 | } |
889 | 889 | ||
890 | AssetBase asset; | 890 | AssetBase asset; |
891 | asset = new AssetBase(); | 891 | asset = new AssetBase(assetID, assetName, assType); |
892 | asset.FullID = assetID; | ||
893 | asset.Type = assType; | ||
894 | asset.Name = assetName; | ||
895 | asset.Data = data; | 892 | asset.Data = data; |
896 | if (AddNewAsset != null) | 893 | if (AddNewAsset != null) |
897 | AddNewAsset(asset); | 894 | AddNewAsset(asset); |
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs index 3dc6b4e..18a3e01 100644 --- a/OpenSim/Framework/Tests/AssetBaseTest.cs +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs | |||
@@ -67,8 +67,7 @@ namespace OpenSim.Framework.Tests | |||
67 | 67 | ||
68 | private void CheckContainsReferences(AssetType assetType, bool expected) | 68 | private void CheckContainsReferences(AssetType assetType, bool expected) |
69 | { | 69 | { |
70 | AssetBase asset = new AssetBase(); | 70 | AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType); |
71 | asset.Type = (sbyte)assetType; | ||
72 | bool actual = asset.ContainsReferences; | 71 | bool actual = asset.ContainsReferences; |
73 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); | 72 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); |
74 | } | 73 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index 697bbe6..adf171e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs | |||
@@ -197,11 +197,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
197 | 197 | ||
198 | private void Initialise(UUID fileID, string fileName) | 198 | private void Initialise(UUID fileID, string fileName) |
199 | { | 199 | { |
200 | m_asset = new AssetBase(); | 200 | m_asset = new AssetBase(fileID, fileName, type); |
201 | m_asset.FullID = fileID; | ||
202 | m_asset.Type = type; | ||
203 | m_asset.Data = new byte[0]; | 201 | m_asset.Data = new byte[0]; |
204 | m_asset.Name = fileName; | ||
205 | m_asset.Description = "empty"; | 202 | m_asset.Description = "empty"; |
206 | m_asset.Local = true; | 203 | m_asset.Local = true; |
207 | m_asset.Temporary = true; | 204 | m_asset.Temporary = true; |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index e192b81..f698ea1 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -112,11 +112,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
112 | bool storeLocal, bool tempFile) | 112 | bool storeLocal, bool tempFile) |
113 | { | 113 | { |
114 | ourClient = remoteClient; | 114 | ourClient = remoteClient; |
115 | m_asset = new AssetBase(); | 115 | m_asset = new AssetBase(assetID, "blank", type); |
116 | m_asset.FullID = assetID; | ||
117 | m_asset.Type = type; | ||
118 | m_asset.Data = data; | 116 | m_asset.Data = data; |
119 | m_asset.Name = "blank"; | ||
120 | m_asset.Description = "empty"; | 117 | m_asset.Description = "empty"; |
121 | m_asset.Local = storeLocal; | 118 | m_asset.Local = storeLocal; |
122 | m_asset.Temporary = tempFile; | 119 | m_asset.Temporary = tempFile; |
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 7456e8c..5fde35f 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -238,12 +238,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
238 | 238 | ||
239 | if (m_cache != null) | 239 | if (m_cache != null) |
240 | { | 240 | { |
241 | AssetBase layerDecodeAsset = new AssetBase(); | 241 | string assetID = "j2kCache_" + AssetId.ToString(); |
242 | layerDecodeAsset.ID = "j2kCache_" + AssetId.ToString(); | 242 | |
243 | AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard); | ||
243 | layerDecodeAsset.Local = true; | 244 | layerDecodeAsset.Local = true; |
244 | layerDecodeAsset.Name = layerDecodeAsset.ID; | ||
245 | layerDecodeAsset.Temporary = true; | 245 | layerDecodeAsset.Temporary = true; |
246 | layerDecodeAsset.Type = (sbyte)AssetType.Notecard; | ||
247 | 246 | ||
248 | #region Serialize Layer Data | 247 | #region Serialize Layer Data |
249 | 248 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f761bf0..a4445eb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -389,11 +389,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
389 | { | 389 | { |
390 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; | 390 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; |
391 | 391 | ||
392 | //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); | 392 | if (assetType == (sbyte)AssetType.Unknown) |
393 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); | ||
393 | 394 | ||
394 | AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); | 395 | //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); |
395 | 396 | ||
396 | asset.Type = assetType; | 397 | AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType); |
397 | asset.Data = data; | 398 | asset.Data = data; |
398 | 399 | ||
399 | m_scene.AssetService.Store(asset); | 400 | m_scene.AssetService.Store(asset); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index b0fdcd6..8ee9194 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -122,8 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
122 | } | 122 | } |
123 | 123 | ||
124 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 124 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
125 | AssetBase asset1 = new AssetBase(); | 125 | AssetBase asset1 = new AssetBase(asset1Id, asset1Id.ToString(), (sbyte)AssetType.Object); |
126 | asset1.FullID = asset1Id; | ||
127 | asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); | 126 | asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); |
128 | scene.AssetService.Store(asset1); | 127 | scene.AssetService.Store(asset1); |
129 | 128 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 9a6c49a..43761fc 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -311,11 +311,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
311 | } | 311 | } |
312 | 312 | ||
313 | // Create a new asset for user | 313 | // Create a new asset for user |
314 | AssetBase asset = new AssetBase(); | 314 | AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture); |
315 | asset.FullID = UUID.Random(); | ||
316 | asset.Data = assetData; | 315 | asset.Data = assetData; |
317 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | ||
318 | asset.Type = 0; | ||
319 | asset.Description = String.Format("URL image : {0}", Url); | 316 | asset.Description = String.Format("URL image : {0}", Url); |
320 | asset.Local = false; | 317 | asset.Local = false; |
321 | asset.Temporary = ((Disp & DISP_TEMP) != 0); | 318 | asset.Temporary = ((Disp & DISP_TEMP) != 0); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index c261943..70a225e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -332,10 +332,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
332 | { | 332 | { |
333 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; | 333 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; |
334 | 334 | ||
335 | if (assetType == (sbyte)AssetType.Unknown) | ||
336 | m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); | ||
337 | |||
335 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); | 338 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); |
336 | 339 | ||
337 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); | 340 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType); |
338 | asset.Type = assetType; | ||
339 | asset.Data = data; | 341 | asset.Data = data; |
340 | 342 | ||
341 | // We're relying on the asset service to do the sensible thing and not store the asset if it already | 343 | // We're relying on the asset service to do the sensible thing and not store the asset if it already |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs index 5208e7a..2d2c570 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs | |||
@@ -158,9 +158,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
158 | 158 | ||
159 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); | 159 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); |
160 | 160 | ||
161 | AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); | 161 | AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType); |
162 | asset.Description = metadata.Description; | 162 | asset.Description = metadata.Description; |
163 | asset.Type = metadata.AssetType; | ||
164 | asset.Data = data; | 163 | asset.Data = data; |
165 | 164 | ||
166 | m_cache.Store(asset); | 165 | m_cache.Store(asset); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs index ddac515..2ff635b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs | |||
@@ -52,16 +52,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
52 | 52 | ||
53 | public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) | 53 | public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) |
54 | { | 54 | { |
55 | 55 | m_asset = new AssetBase(UUID.Zero, pClientFilename, type); | |
56 | m_asset = new AssetBase(); | ||
57 | m_asset.FullID = UUID.Zero; | ||
58 | m_asset.Type = type; | ||
59 | m_asset.Data = new byte[0]; | 56 | m_asset.Data = new byte[0]; |
60 | m_asset.Name = pClientFilename; | ||
61 | m_asset.Description = "empty"; | 57 | m_asset.Description = "empty"; |
62 | m_asset.Local = true; | 58 | m_asset.Local = true; |
63 | m_asset.Temporary = true; | 59 | m_asset.Temporary = true; |
64 | |||
65 | } | 60 | } |
66 | 61 | ||
67 | public ulong XferID | 62 | public ulong XferID |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f4b54aa..44a651f 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1077,14 +1077,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1077 | 1077 | ||
1078 | m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID; | 1078 | m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID; |
1079 | 1079 | ||
1080 | AssetBase asset = new AssetBase(); | 1080 | AssetBase asset = new AssetBase( |
1081 | asset.FullID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | 1081 | m_scene.RegionInfo.RegionSettings.TerrainImageID, |
1082 | "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(), | ||
1083 | (sbyte)AssetType.Texture); | ||
1082 | asset.Data = data; | 1084 | asset.Data = data; |
1083 | asset.Name | ||
1084 | = "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); | ||
1085 | asset.Description = m_scene.RegionInfo.RegionName; | 1085 | asset.Description = m_scene.RegionInfo.RegionName; |
1086 | |||
1087 | asset.Type = 0; | ||
1088 | asset.Temporary = temporary; | 1086 | asset.Temporary = temporary; |
1089 | m_scene.AssetService.Store(asset); | 1087 | m_scene.AssetService.Store(asset); |
1090 | } | 1088 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 7a66d23..ec50598 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
118 | // HGAssetService dispatches it to the remote grid. | 118 | // HGAssetService dispatches it to the remote grid. |
119 | // It's not pretty, but the best that can be done while | 119 | // It's not pretty, but the best that can be done while |
120 | // not having a global naming infrastructure | 120 | // not having a global naming infrastructure |
121 | AssetBase asset1 = new AssetBase(); | 121 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type); |
122 | Copy(asset, asset1); | 122 | Copy(asset, asset1); |
123 | try | 123 | try |
124 | { | 124 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 00743fc..6b2c7d3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -627,11 +627,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
627 | /// <returns></returns> | 627 | /// <returns></returns> |
628 | private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) | 628 | private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) |
629 | { | 629 | { |
630 | AssetBase asset = new AssetBase(); | 630 | AssetBase asset = new AssetBase(UUID.Random(), name, assetType); |
631 | asset.Name = name; | ||
632 | asset.Description = description; | 631 | asset.Description = description; |
633 | asset.Type = assetType; | ||
634 | asset.FullID = UUID.Random(); | ||
635 | asset.Data = (data == null) ? new byte[1] : data; | 632 | asset.Data = (data == null) ? new byte[1] : data; |
636 | 633 | ||
637 | return asset; | 634 | return asset; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1e9201e..17026e5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1918,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1918 | } | 1918 | } |
1919 | 1919 | ||
1920 | 1920 | ||
1921 | AssetBase Animasset = new AssetBase(); | 1921 | AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation); |
1922 | Animasset.Data = anim.ToBytes(); | 1922 | Animasset.Data = anim.ToBytes(); |
1923 | Animasset.Temporary = true; | 1923 | Animasset.Temporary = true; |
1924 | Animasset.Local = true; | 1924 | Animasset.Local = true; |
1925 | Animasset.FullID = UUID.Random(); | ||
1926 | Animasset.ID = Animasset.FullID.ToString(); | ||
1927 | Animasset.Name = "Random Animation"; | ||
1928 | Animasset.Type = (sbyte)AssetType.Animation; | ||
1929 | Animasset.Description = "dance"; | 1925 | Animasset.Description = "dance"; |
1930 | //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); | 1926 | //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); |
1931 | 1927 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs index 963cab5..8ea7ad3 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs | |||
@@ -49,11 +49,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
49 | 49 | ||
50 | public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) | 50 | public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) |
51 | { | 51 | { |
52 | AssetBase asset = new AssetBase(); | 52 | AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture); |
53 | asset.FullID = UUID.Random(); | ||
54 | asset.Data = OpenJPEG.EncodeFromImage(data, lossless); | 53 | asset.Data = OpenJPEG.EncodeFromImage(data, lossless); |
55 | asset.Name = "MRMDynamicImage"; | ||
56 | asset.Type = 0; | ||
57 | asset.Description = "MRM Image"; | 54 | asset.Description = "MRM Image"; |
58 | asset.Local = false; | 55 | asset.Local = false; |
59 | asset.Temporary = temporary; | 56 | asset.Temporary = temporary; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f1ceb80..f7ee3d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1483,12 +1483,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1483 | m_host.AddScriptLPS(1); | 1483 | m_host.AddScriptLPS(1); |
1484 | 1484 | ||
1485 | // Create new asset | 1485 | // Create new asset |
1486 | AssetBase asset = new AssetBase(); | 1486 | AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard); |
1487 | asset.Name = notecardName; | ||
1488 | asset.Description = "Script Generated Notecard"; | 1487 | asset.Description = "Script Generated Notecard"; |
1489 | asset.Type = 7; | 1488 | string notecardData = String.Empty; |
1490 | asset.FullID = UUID.Random(); | ||
1491 | string notecardData = ""; | ||
1492 | 1489 | ||
1493 | for (int i = 0; i < contents.Length; i++) { | 1490 | for (int i = 0; i < contents.Length; i++) { |
1494 | notecardData += contents.GetLSLStringItem(i) + "\n"; | 1491 | notecardData += contents.GetLSLStringItem(i) + "\n"; |
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index ecda85a..8e311d7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | |||
@@ -243,7 +243,7 @@ namespace OpenSim.Services.Connectors | |||
243 | if (metadata == null) | 243 | if (metadata == null) |
244 | return false; | 244 | return false; |
245 | 245 | ||
246 | asset = new AssetBase(); | 246 | asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type); |
247 | asset.Metadata = metadata; | 247 | asset.Metadata = metadata; |
248 | } | 248 | } |
249 | asset.Data = data; | 249 | asset.Data = data; |
diff --git a/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs index 3d7f112..2f33bab 100644 --- a/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs | |||
@@ -140,12 +140,11 @@ namespace OpenSim.Services.Connectors.Grid | |||
140 | Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg"); | 140 | Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg"); |
141 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | 141 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); |
142 | byte[] imageData = OpenJPEG.EncodeFromImage(m, true); | 142 | byte[] imageData = OpenJPEG.EncodeFromImage(m, true); |
143 | AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); | 143 | AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString(), (sbyte)AssetType.Texture); |
144 | 144 | ||
145 | // !!! for now | 145 | // !!! for now |
146 | //info.RegionSettings.TerrainImageID = ass.FullID; | 146 | //info.RegionSettings.TerrainImageID = ass.FullID; |
147 | 147 | ||
148 | ass.Type = (int)AssetType.Texture; | ||
149 | ass.Temporary = true; | 148 | ass.Temporary = true; |
150 | ass.Local = true; | 149 | ass.Local = true; |
151 | ass.Data = imageData; | 150 | ass.Data = imageData; |