Fixed several unhandled exceptions and performance issues with PrimitiveBaseShape.Textures. This really should be moved from a property to a method if it is going to decode a byte[] into a TextureEntry each time

This commit is contained in:
John Hurliman
2010-03-16 11:50:22 -07:00
parent d722519b31
commit b4dcdffb50
5 changed files with 71 additions and 59 deletions

View File

@@ -285,24 +285,22 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
return;
}
byte[] assetData;
byte[] assetData = null;
AssetBase oldAsset = null;
if (BlendWithOldTexture)
{
UUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID;
oldAsset = scene.AssetService.Get(lastTextureID.ToString());
if (oldAsset != null)
Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
if (defaultFace != null)
{
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
}
else
{
assetData = new byte[data.Length];
Array.Copy(data, assetData, data.Length);
oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());
if (oldAsset != null)
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
}
}
else
if (assetData == null)
{
assetData = new byte[data.Length];
Array.Copy(data, assetData, data.Length);

View File

@@ -251,13 +251,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// if you want tree blocks on the map comment the above line and uncomment the below line
//mapdotspot = Color.PaleGreen;
if (part.Shape.Textures == null)
Primitive.TextureEntry textureEntry = part.Shape.Textures;
if (textureEntry == null || textureEntry.DefaultTexture == null)
continue;
if (part.Shape.Textures.DefaultTexture == null)
continue;
Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
Color4 texcolor = textureEntry.DefaultTexture.RGBA;
// Not sure why some of these are null, oh well.