diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 76dac61..f441aa9 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -203,44 +203,54 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
203 | { | 203 | { |
204 | string bestguess = string.Empty; | 204 | string bestguess = string.Empty; |
205 | Dictionary<UUID, int> counts = new Dictionary<UUID, int>(); | 205 | Dictionary<UUID, int> counts = new Dictionary<UUID, int>(); |
206 | if (sog.RootPart.Shape != null && sog.RootPart.Shape.ProfileShape == ProfileShape.Square && | 206 | |
207 | sog.RootPart.Shape.Textures != null && sog.RootPart.Shape.Textures.FaceTextures != null) | 207 | PrimitiveBaseShape shape = sog.RootPart.Shape; |
208 | if (shape != null && shape.ProfileShape == ProfileShape.Square) | ||
208 | { | 209 | { |
209 | if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero && | 210 | Primitive.TextureEntry textures = shape.Textures; |
210 | sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage && | 211 | if (textures != null) |
211 | sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage && | ||
212 | sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50) | ||
213 | { | 212 | { |
214 | counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8; | 213 | if (textures.DefaultTexture != null && |
215 | } | 214 | textures.DefaultTexture.TextureID != UUID.Zero && |
215 | textures.DefaultTexture.TextureID != m_DefaultImage && | ||
216 | textures.DefaultTexture.TextureID != m_BlankImage && | ||
217 | textures.DefaultTexture.RGBA.A < 50f) | ||
218 | { | ||
219 | counts[textures.DefaultTexture.TextureID] = 8; | ||
220 | } | ||
216 | 221 | ||
217 | foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures) | 222 | if (textures.FaceTextures != null) |
218 | { | ||
219 | if (tentry != null) | ||
220 | { | 223 | { |
221 | if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50) | 224 | foreach (Primitive.TextureEntryFace tentry in textures.FaceTextures) |
222 | { | 225 | { |
223 | int c = 0; | 226 | if (tentry != null) |
224 | counts.TryGetValue(tentry.TextureID, out c); | 227 | { |
225 | counts[tentry.TextureID] = c + 1; | 228 | if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50) |
226 | // decrease the default texture count | 229 | { |
227 | if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID)) | 230 | int c = 0; |
228 | counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1; | 231 | counts.TryGetValue(tentry.TextureID, out c); |
232 | counts[tentry.TextureID] = c + 1; | ||
233 | // decrease the default texture count | ||
234 | if (counts.ContainsKey(textures.DefaultTexture.TextureID)) | ||
235 | counts[textures.DefaultTexture.TextureID] = counts[textures.DefaultTexture.TextureID] - 1; | ||
236 | } | ||
237 | } | ||
229 | } | 238 | } |
230 | } | 239 | } |
231 | } | ||
232 | 240 | ||
233 | // Let's pick the most unique texture | 241 | // Let's pick the most unique texture |
234 | int min = 9999; | 242 | int min = 9999; |
235 | foreach (KeyValuePair<UUID, int> kv in counts) | 243 | foreach (KeyValuePair<UUID, int> kv in counts) |
236 | { | ||
237 | if (kv.Value < min && kv.Value >= 1) | ||
238 | { | 244 | { |
239 | bestguess = kv.Key.ToString(); | 245 | if (kv.Value < min && kv.Value >= 1) |
240 | min = kv.Value; | 246 | { |
247 | bestguess = kv.Key.ToString(); | ||
248 | min = kv.Value; | ||
249 | } | ||
241 | } | 250 | } |
242 | } | 251 | } |
243 | } | 252 | } |
253 | |||
244 | return bestguess; | 254 | return bestguess; |
245 | } | 255 | } |
246 | } | 256 | } |