Tested on Windows, b11028, happening on Desktop target.
When applying an effect through the "apply effect [] to [instance]" block, only the first effect is applied. Any subsequent effect does not reflect on the image instance.
Through a discussion on Discord, we figured out there was an inconsistency in the setFilterForImage function in Script.hx. The original problematic line is 2810:
If I switch both to "img.img", or just to "img." (applying the same to the clearFiltersForImage function right below) allows for stacking effects. When I switched to "img.img.", there was a caveat: the new stack of effects is only applied when you make a change to the image that instance is from. Using the "draw image onto image" or "set pixel" blocks both enabled the update. When I switched everything to just "img.", this issue disappeared.
This is what I changed the lines in Script.hx to, and everything worked as expected with these as far as I could tell:
I don't know if if there are any other ramifications.
Related Discord discussion: https://discord.com/channels/209323692205932544/227870283749523459/989172953876951110
The linked message is a reply to the my first message that spawned the discussion.
Sample Game: all code is in the "Test Actor" events tab. Test on a desktop target.
- Press up to apply a tint effect at 20%, only one will appear. Pressing up more than once won't change the image instance any further without the changes on Script.hx.
- Press down to set a pixel in the image. All the previously stacked effects will appear at once, in case the caveat I mentioned happens after the change.
- Press enter to remove all effects.
When applying an effect through the "apply effect [] to [instance]" block, only the first effect is applied. Any subsequent effect does not reflect on the image instance.
Through a discussion on Discord, we figured out there was an inconsistency in the setFilterForImage function in Script.hx. The original problematic line is 2810:
Code: [Select]
img.img.filters = img.filters.concat([filter]);
If I switch both to "img.img", or just to "img." (applying the same to the clearFiltersForImage function right below) allows for stacking effects. When I switched to "img.img.", there was a caveat: the new stack of effects is only applied when you make a change to the image that instance is from. Using the "draw image onto image" or "set pixel" blocks both enabled the update. When I switched everything to just "img.", this issue disappeared.
This is what I changed the lines in Script.hx to, and everything worked as expected with these as far as I could tell:
Code: [Select]
public static function setFilterForImage(img:BitmapWrapper, filter:BitmapFilter)
{
if(img != null)
{
img.filters = img.filters.concat([filter]);
}
}
public static function clearFiltersForImage(img:BitmapWrapper)
{
if(img != null)
{
img.filters = [];
}
}
I don't know if if there are any other ramifications.
Related Discord discussion: https://discord.com/channels/209323692205932544/227870283749523459/989172953876951110
The linked message is a reply to the my first message that spawned the discussion.
Sample Game: all code is in the "Test Actor" events tab. Test on a desktop target.
- Press up to apply a tint effect at 20%, only one will appear. Pressing up more than once won't change the image instance any further without the changes on Script.hx.
- Press down to set a pixel in the image. All the previously stacked effects will appear at once, in case the caveat I mentioned happens after the change.
- Press enter to remove all effects.