29 using System.Collections.Generic;
31 using OpenMetaverse.StructuredData;
33 namespace OpenSim.Framework
38 public uint TextureIndex {
get; set; }
39 public UUID CacheId {
get; set; }
40 public UUID TextureID {
get; set; }
46 int itemmax = AvatarAppearance.TEXTURE_COUNT;
48 for (uint i=0;i<itemmax;i++)
49 retitems[i] =
new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i};
55 List<WearableCacheItem> ret =
new List<WearableCacheItem>();
56 if (pInput.Type == OSDType.Array)
59 foreach (
OSDMap item
in itemarray)
63 TextureIndex = item[
"textureindex"].AsUInteger(),
64 CacheId = item[
"cacheid"].AsUUID(),
65 TextureID = item[
"textureid"].AsUUID()
68 if (dataCache != null && item.ContainsKey(
"assetdata"))
70 AssetBase asset =
new AssetBase(item[
"textureid"].AsUUID(),
"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString());
71 asset.Temporary =
true;
72 asset.Data = item[
"assetdata"].AsBinary();
73 dataCache.Cache(asset);
77 else if (pInput.Type == OSDType.Map)
81 TextureIndex = item[
"textureindex"].AsUInteger(),
82 CacheId = item[
"cacheid"].AsUUID(),
83 TextureID = item[
"textureid"].AsUUID()
85 if (dataCache != null && item.ContainsKey(
"assetdata"))
87 string assetCreator = item[
"assetcreator"].AsString();
88 string assetName = item[
"assetname"].AsString();
89 AssetBase asset =
new AssetBase(item[
"textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator);
90 asset.Temporary =
true;
91 asset.Data = item[
"assetdata"].AsBinary();
92 dataCache.Cache(asset);
109 itemmap.Add(
"textureindex", OSD.FromUInteger(item.TextureIndex));
110 itemmap.Add(
"cacheid", OSD.FromUUID(item.CacheId));
111 itemmap.Add(
"textureid", OSD.FromUUID(item.TextureID));
112 if (dataCache != null)
116 AssetBase assetItem = dataCache.Get(item.TextureID.ToString());
117 if (assetItem != null)
119 itemmap.Add(
"assetdata", OSD.FromBinary(assetItem.Data));
120 itemmap.Add(
"assetcreator", OSD.FromString(assetItem.CreatorID));
121 itemmap.Add(
"assetname", OSD.FromString(assetItem.Name));
137 for (
int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
139 int idx = AvatarAppearance.BAKE_INDICES[i];
144 itemmap.Add(
"textureindex", OSD.FromUInteger(item.TextureIndex));
145 itemmap.Add(
"cacheid", OSD.FromUUID(item.CacheId));
146 itemmap.Add(
"textureid", OSD.FromUUID(item.TextureID));
164 if (pInput.Type == OSDType.Array)
167 foreach (
OSDMap item
in itemarray)
169 int idx = (int)item[
"textureindex"].AsUInteger();
170 if (idx < 0 || idx > pcache.Length)
172 pcache[idx].CacheId = item[
"cacheid"].AsUUID();
173 pcache[idx].TextureID = item[
"textureid"].AsUUID();
185 pcache[idx].TextureAsset = null;
193 for (
int i = 0; i < pcacheItems.Length; i++)
195 if (pcacheItems[i].TextureIndex == pTextureIndex)
196 return pcacheItems[i];
202 for (
int i = 0; i < pcacheItems.Length; i++)
204 if (pcacheItems[i].CacheId == pCacheId)
205 return pcacheItems[i];
211 for (
int i = 0; i < pcacheItems.Length; i++)
213 if (pcacheItems[i].TextureID == pTextureId)
214 return pcacheItems[i];
OpenMetaverse.StructuredData.OSDArray OSDArray
static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache)
static readonly byte[] BAKE_INDICES
Contains the Avatar's Appearance and methods to manipulate the appearance.
OpenMetaverse.StructuredData.OSDMap OSDMap
bool Check(string id)
Check whether an asset with the specified id exists in the cache.
static WearableCacheItem[] BakedFromOSD(OSD pInput)
static WearableCacheItem SearchTextureCacheId(UUID pCacheId, WearableCacheItem[] pcacheItems)
static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems)
static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
Asset class. All Assets are reference by this class or a class derived from this class ...
static WearableCacheItem SearchTextureTextureId(UUID pTextureId, WearableCacheItem[] pcacheItems)
OpenMetaverse.StructuredData.OSD OSD
static WearableCacheItem[] GetDefaultCacheItem()
static WearableCacheItem SearchTextureIndex(uint pTextureIndex, WearableCacheItem[] pcacheItems)