aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WearableCacheItem.cs
diff options
context:
space:
mode:
authorUbitUmarov2014-08-14 01:53:51 +0100
committerUbitUmarov2014-08-14 01:53:51 +0100
commita1cc218f10be109e6cca19f8e39d877243974984 (patch)
treef27a3b7e09912b55b90347a1e751ac4fbc79808c /OpenSim/Framework/WearableCacheItem.cs
parent put back baked textures debug msgs at start of validatebaked... (diff)
downloadopensim-SC-a1cc218f10be109e6cca19f8e39d877243974984.zip
opensim-SC-a1cc218f10be109e6cca19f8e39d877243974984.tar.gz
opensim-SC-a1cc218f10be109e6cca19f8e39d877243974984.tar.bz2
opensim-SC-a1cc218f10be109e6cca19f8e39d877243974984.tar.xz
*DANGER* make baked textures cross and make use of it * UNTESTED *
issue: alll this seems to be sent back to childs, need to stop that
Diffstat (limited to 'OpenSim/Framework/WearableCacheItem.cs')
-rw-r--r--OpenSim/Framework/WearableCacheItem.cs60
1 files changed, 59 insertions, 1 deletions
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs
index a890d3b..f49697d 100644
--- a/OpenSim/Framework/WearableCacheItem.cs
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -49,7 +49,6 @@ namespace OpenSim.Framework
49 retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i}; 49 retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i};
50 return retitems; 50 return retitems;
51 } 51 }
52
53 52
54 public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) 53 public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
55 { 54 {
@@ -100,6 +99,7 @@ namespace OpenSim.Framework
100 return ret.ToArray(); 99 return ret.ToArray();
101 100
102 } 101 }
102
103 public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) 103 public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache)
104 { 104 {
105 OSDArray arr = new OSDArray(); 105 OSDArray arr = new OSDArray();
@@ -126,6 +126,64 @@ namespace OpenSim.Framework
126 } 126 }
127 return arr; 127 return arr;
128 } 128 }
129
130 public static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems)
131 {
132 if (pcacheItems.Length < AvatarAppearance.BAKE_INDICES[AvatarAppearance.BAKE_INDICES.Length - 1])
133 return null;
134
135 OSDArray arr = new OSDArray();
136
137 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
138 {
139 int idx = AvatarAppearance.BAKE_INDICES[i];
140
141 WearableCacheItem item = pcacheItems[idx];
142
143 OSDMap itemmap = new OSDMap();
144 itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex));
145 itemmap.Add("cacheid", OSD.FromUUID(item.CacheId));
146 itemmap.Add("textureid", OSD.FromUUID(item.TextureID));
147 if (item.TextureAsset != null)
148 {
149 itemmap.Add("assetdata", OSD.FromBinary(item.TextureAsset.Data));
150 itemmap.Add("assetcreator", OSD.FromString(item.TextureAsset.CreatorID));
151 itemmap.Add("assetname", OSD.FromString(item.TextureAsset.Name));
152 }
153 arr.Add(itemmap);
154 }
155 return arr;
156 }
157
158 public static WearableCacheItem[] BakedFromOSD(OSD pInput)
159 {
160 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem();
161
162 if (pInput.Type == OSDType.Array)
163 {
164 OSDArray itemarray = (OSDArray)pInput;
165 foreach (OSDMap item in itemarray)
166 {
167 int idx = (int)item["textureindex"].AsUInteger();
168 if (idx < 0 || idx > pcache.Length)
169 continue;
170 pcache[idx].CacheId = item["cacheid"].AsUUID();
171 pcache[idx].TextureID = item["textureid"].AsUUID();
172 if (item.ContainsKey("assetdata"))
173 {
174 AssetBase asset = new AssetBase(item["textureid"].AsUUID(), "BakedTexture", (sbyte)AssetType.Texture, UUID.Zero.ToString());
175 asset.Temporary = true;
176 asset.Local = true;
177 asset.Data = item["assetdata"].AsBinary();
178 pcache[idx].TextureAsset = asset;
179 }
180 else
181 pcache[idx].TextureAsset = null;
182 }
183 }
184 return pcache;
185 }
186
129 public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) 187 public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems)
130 { 188 {
131 for (int i = 0; i < pcacheItems.Length; i++) 189 for (int i = 0; i < pcacheItems.Length; i++)