revert the thread level change; remove unused dynamic texture timer from internal code; let blend alpha work if < 255; let blend work with the selected face; etc

0.9.0-post-fixes
UbitUmarov 2017-06-24 09:24:56 +01:00
parent 8d1dd44edb
commit 1a8a77c41e
6 changed files with 72 additions and 98 deletions

View File

@ -138,13 +138,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.newTextureID = newTextureID;
}
if (updater.UpdateTimer == 0)
lock (Updaters)
{
lock (Updaters)
{
if (Updaters.ContainsKey(updater.UpdaterID))
Updaters.Remove(updater.UpdaterID);
}
if (Updaters.ContainsKey(updater.UpdaterID))
Updaters.Remove(updater.UpdaterID);
}
}
}
@ -171,21 +168,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer)
string extraParams)
{
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255);
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, false, 255);
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
string extraParams, bool SetBlending, byte AlphaValue)
{
return AddDynamicTextureURL(simID, primID, contentType, url,
extraParams, updateTimer, SetBlending,
(int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, SetBlending,
(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer, bool SetBlending,
string extraParams, bool SetBlending,
int disp, byte AlphaValue, int face)
{
if (RenderPlugins.ContainsKey(contentType))
@ -195,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.PrimID = primID;
updater.ContentType = contentType;
updater.Url = url;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
@ -218,20 +213,21 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer)
string extraParams)
{
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255);
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, false,
(DISP_TEMP|DISP_EXPIRE), 255, ALL_SIDES);
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
string extraParams, bool SetBlending, byte AlphaValue)
{
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending,
(int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, SetBlending,
(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
string extraParams, bool SetBlending, int disp, byte AlphaValue, int face)
{
if (!RenderPlugins.ContainsKey(contentType))
return UUID.Zero;
@ -257,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.PrimID = primID;
updater.ContentType = contentType;
updater.BodyData = data;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
@ -403,10 +398,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public byte FrontAlpha = 255;
public string Params;
public UUID PrimID;
public bool SetNewFrontAlpha = false;
public UUID SimUUID;
public UUID UpdaterID;
public int UpdateTimer;
public int Face;
public int Disp;
public string Url;
@ -414,7 +407,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public DynamicTextureUpdater()
{
UpdateTimer = 0;
BodyData = null;
}
@ -440,19 +432,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
oldID = tmptex.DefaultTexture.TextureID;
tmptex.DefaultTexture.TextureID = textureID;
for(int i = 0; i < tmptex.FaceTextures.Length; i++)
tmptex.FaceTextures[i] = null;
}
else
{
try
{
Primitive.TextureEntryFace texface = tmptex.GetFace((uint)Face);
if(texface == null)
tmptex.GetFace((uint)Face);
else
{
if(texface.TextureID != null && texface.TextureID != UUID.Zero)
oldID = texface.TextureID;
}
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
oldID = texface.TextureID;
texface.TextureID = textureID;
tmptex.FaceTextures[Face] = texface;
}
@ -462,10 +450,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
}
// I'm pretty sure we always want to force this to true
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
// tmptex.DefaultTexture.Fullbright = true;
part.UpdateTextureEntry(tmptex.GetBytes());
}
@ -498,13 +482,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
if (BlendWithOldTexture)
{
Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
if (defaultFace != null)
Primitive.TextureEntryFace curFace;
if(Face == ALL_SIDES)
curFace = part.Shape.Textures.DefaultTexture;
else
{
oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());
try
{
curFace = part.Shape.Textures.GetFace((uint)Face);
}
catch
{
curFace = null;
}
}
if (curFace != null)
{
oldAsset = scene.AssetService.Get(curFace.TextureID.ToString());
if (oldAsset != null)
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
assetData = BlendTextures(data, oldAsset.Data, FrontAlpha);
}
}
@ -555,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
return asset.FullID;
}
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha)
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, byte newAlpha)
{
ManagedImage managedImage;
Image image;
@ -575,7 +572,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
Bitmap image2 = new Bitmap(image);
image.Dispose();
if (setNewAlpha)
if (newAlpha < 255)
SetAlpha(ref image1, newAlpha);
using(Bitmap joint = MergeBitMaps(image1, image2))

View File

@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
"",
0);
"");
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"alpha:250",
0);
"alpha:250");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
"",
0);
"");
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"1024",
0);
"1024");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"1024",
0);
"1024");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"alpha:250",
0);
"alpha:250");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}

View File

@ -44,14 +44,13 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name='isReuseable'></param>
void ReturnData(UUID id, IDynamicTexture texture);
UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams);
UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
int updateTimer);
bool SetBlending, byte AlphaValue);
UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
int updateTimer, bool SetBlending, byte AlphaValue);
UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer);
bool SetBlending, int disp, byte AlphaValue, int face);
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams);
/// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the
/// asset service.
@ -62,8 +61,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// based texture or "image" to create a texture from an image at a particular URL</param>
/// <param name="data">The data for the generator</param>
/// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
/// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
/// the image is updated at the given interval. Not implemented for </param>
/// <param name="SetBlending">
/// If true, the newly generated texture is blended with the appropriate existing ones on the prim
/// </param>
@ -76,7 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
/// </returns>
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer, bool SetBlending, byte AlphaValue);
bool SetBlending, byte AlphaValue);
/// <summary>
/// Apply a dynamically generated texture to the given prim.
@ -87,8 +84,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// based texture or "image" to create a texture from an image at a particular URL</param>
/// <param name="data">The data for the generator</param>
/// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
/// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
/// the image is updated at the given interval. Not implemented for </param>
/// <param name="SetBlending">
/// If true, the newly generated texture is blended with the appropriate existing ones on the prim
/// </param>
@ -109,9 +104,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
/// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
/// </returns>
UUID AddDynamicTextureData(
UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
bool SetBlending, int disp, byte AlphaValue, int face);
void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
out double xSize, out double ySize);

View File

@ -678,7 +678,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
extraParams, timer);
extraParams);
return createdTexture.ToString();
}
else
@ -700,7 +700,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
extraParams, timer, true, (byte) alpha);
extraParams, true, (byte) alpha);
return createdTexture.ToString();
}
else
@ -722,7 +722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
UUID createdTexture =
textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
extraParams, timer, blend, disp, (byte) alpha, face);
extraParams, blend, disp, (byte) alpha, face);
return createdTexture.ToString();
}
else
@ -756,7 +756,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
UUID createdTexture =
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
extraParams, timer, false, 3, 255, face);
extraParams, false, 3, 255, face);
return createdTexture.ToString();
}
@ -786,7 +786,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
UUID createdTexture =
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
extraParams, timer, true, (byte) alpha);
extraParams, true, (byte) alpha);
return createdTexture.ToString();
}
}
@ -801,7 +801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
bool blend, int disp, int timer, int alpha, int face)
{
CheckThreatLevel(ThreatLevel.VeryHigh , "osSetDynamicTextureDataBlendFace");
CheckThreatLevel(ThreatLevel.VeryLow , "osSetDynamicTextureDataBlendFace");
m_host.AddScriptLPS(1);
if (dynamicID == String.Empty)
@ -815,7 +815,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
UUID createdTexture =
textureManager.AddDynamicTextureData(World.RegionInfo.RegionID, m_host.UUID, contentType, data,
extraParams, timer, blend, disp, (byte) alpha, face);
extraParams, blend, disp, (byte) alpha, face);
return createdTexture.ToString();
}
}

View File

@ -118,8 +118,7 @@ namespace OpenSim.Tests.Stress
so.UUID,
m_tests.Vrm.GetContentType(),
string.Format("PenColour BLACK; MoveTo 40,220; FontSize 32; Text {0};", text),
"",
0);
"");
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));

View File

@ -121,6 +121,7 @@
Allow_osReplaceString = true
Allow_osSetDynamicTextureData = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureDataBlend = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureDataBlendFace = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureURL = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureURLBlend = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureURLBlendFace = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
@ -227,7 +228,6 @@
Allow_osGetNotecardLine = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osGetNumberOfNotecardLines = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osRegionNotice = ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetDynamicTextureDataBlendFace = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetRot = false
Allow_osSetParcelDetails = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER