mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
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:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user