It would be very handy to have an option for RenderSetColor not to affect Alpha channel (maybe a tickbox or something simple like that).
Right now I have a few models all using the same Material. The Models should all be of different colors but keep the Alpha from the Material which is changed during runtime (for items that should blink: powerups etc). So as soon as I add a RenderSetColor to the OnRender event, it overwrites the Alpha too, not only the colors.
Attached is an example that will hopefully clarify the issue. It's a version of the example you posted.
Please look in the OnUpdate event. As you can see the Alpha is modified, but this has no effect on the original Model. I added a copy of the flower in the middle of the screen just so you can see that the Material is indeed "flashing".
Also in the FlowerModel.OnRender I added a ZExpression with the solution I'm currently using (commented out).
So I did manage to make it work, it's just that I think it'd be much more elegant to have RenderSetColor affect Alpha only optionally. It's more a question of interface / usability suggestion than anything else
Edit: Substituted a ZExpression with an AnimatorSimple for easier viewing.
solves the situation quite well... maybe it can rather be put to OnUpdate section of the FlowerModel. I agree, if it's possible to modify just RGB and not alpha (or maybe even modify just part of the RGBA independently), the solution would be little bit more robust.
Thanks for taking a look! (I just uploaded a new version with some cosmetic differences but the principle is the same as in the old version.)
Yes maybe putting the code in OnUpdate would be better but regardless it's still something that feels a bit like playing catching up.
I could also use some other solutions to this situation, it's not such a big problem but I'm just trying to say that it'd be more elegant if it could be solved before it even pops up.
Not particularly elegant as it basically "exploits" the way RenderSetColor is implemented .. but it works
Anyway, keep in mind that the OpenGL API* only has functions that set all 4 color components at once. Although that doesn't mean you can't provide a Alpha checkbox on RenderSetColor and manage it at software level of course.
*Fixed-function at least, but since ZGE supports that as well it's the lowest-common denominator.
(from Kjell's example, which is how it's done currently) requires a bit of pointless mental jogging in case somebody looks at it a week after it was set it up ("What was that ZExpression doing? Changing the position of ? ....or... " + then reading the comment... etc).