llSetLinkGLTFOverrides fails to clear alpha override
tracked
Medea Destiny
According to https://wiki.secondlife.com/wiki/LlSetLinkGLTFOverrides, "Passing an empty string ("") as the override value will clear that override." This is true as far as I have tested except for OVERRIDE_GLTF_BASE_ALPHA, where setting to "" seems to simply do nothing.
To Reproduce: Rez a prim, add a PBR material to it, and put the following script into it:
default
{
touch_start(integer total_number)
{
toggle=!toggle;
if(toggle) llSetLinkGLTFOverrides(LINK_THIS,ALL_SIDES,[OVERRIDE_GLTF_BASE_ALPHA_MODE,PRIM_GLTF_ALPHA_MODE_BLEND,OVERRIDE_GLTF_BASE_ALPHA,0]);
else llSetLinkGLTFOverrides(LINK_THIS,ALL_SIDES,[OVERRIDE_GLTF_BASE_ALPHA_MODE,"",OVERRIDE_GLTF_BASE_ALPHA,""]);
}
}
You will see that the alpha will set to 0 on the first click, but will not return to its previous value on the second click. The alpha mode WILL revert as intended if you use a PBR material which is not in blend mode, but the prim remains invisible if the material is not opaque.
The wiki page provides a toggle alpha on/off function, but this simply toggles the alpha value between 0 and 1 rather than setting and then removing an override. Where the base alpha value of a material is not 1, this will fail as it will set the alpha to 1 rather than the correct value.
Log In
Maestro Linden
tracked
Maestro Linden
Hi Medea Destiny, I can reproduce this as well. My version of the repro script is:
integer toggle;
float alpha_override = 0.8;
default
{
state_entry()
{
llListen(0, "", NULL_KEY, "reset");
}
listen(integer channel, string name, key id, string msg)
{
// 'reset' command received. clear any preexisting GLTF material to remove any stray overrides
llSetRenderMaterial(NULL_KEY, 0);
/* the base 777d41ea-1552-eaf3-e048-dda143902154 asset includes an
alpha-blended heart texture with a default alpha level of 0.5 */
llSetRenderMaterial("777d41ea-1552-eaf3-e048-dda143902154", 0);
llSay(0, "Initial material set. Should have no overrides.");
string base_overrides = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0])); // get overrides on face 0
llSay(0, "Base overrides on face 0 are: " + base_overrides);
}
touch_start(integer total_number)
{
toggle = !toggle;
if(toggle)
{
llSay(0, "Setting OVERRIDE_GLTF_BASE_ALPHA = " + (string)alpha_override);
llSetLinkGLTFOverrides(LINK_THIS, 0, [OVERRIDE_GLTF_BASE_ALPHA, alpha_override]);
}
else
{
llSay(0, "Setting OVERRIDE_GLTF_BASE_ALPHA = \"\" (no override)");
llSetLinkGLTFOverrides(LINK_THIS, 0, [OVERRIDE_GLTF_BASE_ALPHA, ""]);
}
llSleep(0.1);
string base_overrides = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0])); // get overrides on face 0
llSay(0, "Base overrides on face 0 are: " + base_overrides);
}
}
In my case, I changed the alpha override value to 0.8 - just in case 0.0 was special somehow. However, I'm seeing that after initially setting OVERRIDE_GLTF_BASE_ALPHA to 0.8, trying to clear it has no effect. This is observed by querying PRIM_GLTF_BASE_COLOR with the script:
Base overrides on face 0 are: ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000,"<1.000000, 1.000000, 1.000000>",0.800000,"","",""]
or by looking at the payload of the
GenericStreamingMessage
that gets sent out (which describes an override update) - OVERRIDE_GLTF_BASE_ALPHA is consistently stuck at 0.8.Medea Destiny
Maestro Linden Yeah I tried with other values, nothing's getting cleared. It's as if the empty string leads to nothing being changed rather than the current value being cleared for the instance of OVERRIDE_GLTF_BASE_ALPHA specifically