diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/WearableCacheItem.cs | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index 427e149..f832ff9 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs | |||
@@ -128,31 +128,27 @@ namespace OpenSim.Framework | |||
128 | return arr; | 128 | return arr; |
129 | } | 129 | } |
130 | 130 | ||
131 | public static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems) | 131 | public static OSDArray BakedToOSD(WearableCacheItem[] pcacheItems, int start, int end) |
132 | { | 132 | { |
133 | if (pcacheItems.Length < AvatarAppearance.BAKE_INDICES[AvatarAppearance.BAKE_INDICES.Length - 1]) | ||
134 | return null; | ||
135 | |||
136 | OSDArray arr = new OSDArray(); | 133 | OSDArray arr = new OSDArray(); |
134 | if(start < 0) | ||
135 | start = 0; | ||
136 | if (end < 0 || end > AvatarAppearance.BAKE_INDICES.Length) | ||
137 | end = AvatarAppearance.BAKE_INDICES.Length; | ||
138 | if (start > end) | ||
139 | return null; | ||
137 | 140 | ||
138 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 141 | for (int i = start; i < end; i++) |
139 | { | 142 | { |
140 | int idx = AvatarAppearance.BAKE_INDICES[i]; | 143 | int idx = AvatarAppearance.BAKE_INDICES[i]; |
141 | 144 | if(idx >= pcacheItems.Length) | |
145 | continue; | ||
142 | WearableCacheItem item = pcacheItems[idx]; | 146 | WearableCacheItem item = pcacheItems[idx]; |
143 | 147 | ||
144 | OSDMap itemmap = new OSDMap(); | 148 | OSDMap itemmap = new OSDMap(); |
145 | itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); | 149 | itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); |
146 | itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); | 150 | itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); |
147 | itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); | 151 | itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); |
148 | /* | ||
149 | if (item.TextureAsset != null) | ||
150 | { | ||
151 | itemmap.Add("assetdata", OSD.FromBinary(item.TextureAsset.Data)); | ||
152 | itemmap.Add("assetcreator", OSD.FromString(item.TextureAsset.CreatorID)); | ||
153 | itemmap.Add("assetname", OSD.FromString(item.TextureAsset.Name)); | ||
154 | } | ||
155 | */ | ||
156 | arr.Add(itemmap); | 152 | arr.Add(itemmap); |
157 | } | 153 | } |
158 | return arr; | 154 | return arr; |
@@ -161,29 +157,17 @@ namespace OpenSim.Framework | |||
161 | public static WearableCacheItem[] BakedFromOSD(OSD pInput) | 157 | public static WearableCacheItem[] BakedFromOSD(OSD pInput) |
162 | { | 158 | { |
163 | WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem(); | 159 | WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem(); |
164 | |||
165 | if (pInput.Type == OSDType.Array) | 160 | if (pInput.Type == OSDType.Array) |
166 | { | 161 | { |
167 | OSDArray itemarray = (OSDArray)pInput; | 162 | OSDArray itemarray = (OSDArray)pInput; |
168 | foreach (OSDMap item in itemarray) | 163 | foreach (OSDMap item in itemarray) |
169 | { | 164 | { |
170 | int idx = (int)item["textureindex"].AsUInteger(); | 165 | int idx = item["textureindex"].AsInteger(); |
171 | if (idx < 0 || idx > pcache.Length) | 166 | if (idx < 0 || idx >= pcache.Length) |
172 | continue; | 167 | continue; |
173 | pcache[idx].CacheId = item["cacheid"].AsUUID(); | 168 | pcache[idx].CacheId = item["cacheid"].AsUUID(); |
174 | pcache[idx].TextureID = item["textureid"].AsUUID(); | 169 | pcache[idx].TextureID = item["textureid"].AsUUID(); |
175 | /* | 170 | pcache[idx].TextureAsset = null; |
176 | if (item.ContainsKey("assetdata")) | ||
177 | { | ||
178 | AssetBase asset = new AssetBase(item["textureid"].AsUUID(), "BakedTexture", (sbyte)AssetType.Texture, UUID.Zero.ToString()); | ||
179 | asset.Temporary = true; | ||
180 | asset.Local = true; | ||
181 | asset.Data = item["assetdata"].AsBinary(); | ||
182 | pcache[idx].TextureAsset = asset; | ||
183 | } | ||
184 | else | ||
185 | */ | ||
186 | pcache[idx].TextureAsset = null; | ||
187 | } | 171 | } |
188 | } | 172 | } |
189 | return pcache; | 173 | return pcache; |
@@ -217,6 +201,4 @@ namespace OpenSim.Framework | |||
217 | return null; | 201 | return null; |
218 | } | 202 | } |
219 | } | 203 | } |
220 | |||
221 | |||
222 | } | 204 | } |