aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/SLUtil.cs
diff options
context:
space:
mode:
authorOren Hurvitz2013-12-06 16:21:11 +0200
committerdahlia2014-01-20 00:38:42 -0800
commit3018b2c5d7c9de0e8da6d158f0848c840b7864ab (patch)
treef06f5b35360de9010e618b2cf7c6c109c0527631 /OpenSim/Framework/SLUtil.cs
parentRenamed MaterialsDemoModule to MaterialsModule (diff)
downloadopensim-SC-3018b2c5d7c9de0e8da6d158f0848c840b7864ab.zip
opensim-SC-3018b2c5d7c9de0e8da6d158f0848c840b7864ab.tar.gz
opensim-SC-3018b2c5d7c9de0e8da6d158f0848c840b7864ab.tar.bz2
opensim-SC-3018b2c5d7c9de0e8da6d158f0848c840b7864ab.tar.xz
Materials module: a) Store materials as assets; b) Finalized it (removed the "Demo" label; removed most of the logging); c) Enabled by default
Changed UuidGatherer to use 'sbyte' to identify assets instead of 'AssetType'. This lets UuidGatherer handle Materials, which are defined in a different enum from 'AssetType'.
Diffstat (limited to 'OpenSim/Framework/SLUtil.cs')
-rw-r--r--OpenSim/Framework/SLUtil.cs40
1 files changed, 33 insertions, 7 deletions
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index cb73e8f..9249105 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -39,8 +39,32 @@ namespace OpenSim.Framework
39 { 39 {
40// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 41
42 /// <summary>
43 /// Asset types used only in OpenSim.
44 /// To avoid clashing with the code numbers used in Second Life, use only negative numbers here.
45 /// </summary>
46 public enum OpenSimAssetType : sbyte
47 {
48 Material = -2
49 }
50
51
42 #region SL / file extension / content-type conversions 52 #region SL / file extension / content-type conversions
43 53
54 /// <summary>
55 /// Returns the Enum entry corresponding to the given code, regardless of whether it belongs
56 /// to the AssetType or OpenSimAssetType enums.
57 /// </summary>
58 public static object AssetTypeFromCode(sbyte assetType)
59 {
60 if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType))
61 return (OpenMetaverse.AssetType)assetType;
62 else if (Enum.IsDefined(typeof(OpenSimAssetType), assetType))
63 return (OpenSimAssetType)assetType;
64 else
65 return OpenMetaverse.AssetType.Unknown;
66 }
67
44 private class TypeMapping 68 private class TypeMapping
45 { 69 {
46 private sbyte assetType; 70 private sbyte assetType;
@@ -56,12 +80,7 @@ namespace OpenSim.Framework
56 80
57 public object AssetType 81 public object AssetType
58 { 82 {
59 get { 83 get { return AssetTypeFromCode(assetType); }
60 if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType))
61 return (OpenMetaverse.AssetType)assetType;
62 else
63 return OpenMetaverse.AssetType.Unknown;
64 }
65 } 84 }
66 85
67 public InventoryType InventoryType 86 public InventoryType InventoryType
@@ -102,6 +121,11 @@ namespace OpenSim.Framework
102 : this((sbyte)assetType, inventoryType, contentType, null, extension) 121 : this((sbyte)assetType, inventoryType, contentType, null, extension)
103 { 122 {
104 } 123 }
124
125 public TypeMapping(OpenSimAssetType assetType, InventoryType inventoryType, string contentType, string extension)
126 : this((sbyte)assetType, inventoryType, contentType, null, extension)
127 {
128 }
105 } 129 }
106 130
107 /// <summary> 131 /// <summary>
@@ -142,7 +166,9 @@ namespace OpenSim.Framework
142 new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), 166 new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"),
143 new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"), 167 new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"),
144 new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), 168 new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"),
145 new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm") 169 new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm"),
170
171 new TypeMapping(OpenSimAssetType.Material, InventoryType.Unknown, "application/llsd+xml", "material")
146 }; 172 };
147 173
148 private static Dictionary<sbyte, string> asset2Content; 174 private static Dictionary<sbyte, string> asset2Content;