Matte pass for selected mesh in Blutility

I’m working on a fairly complex previsualization setup in UE4. One thing we’d like to be able to do is select a few objects and turn them white, and turn the rest black. This will let us screen grab a custom matte pass for compositing later on.

I’ve started to build out this functionality in Blutilities, and it’s working great (graph below). Unfortunately I can’t figure out a way to revert the materials to their original form after I’ve switched them out.

Does anybody have an idea on how to do this?

Thanks for reading!

EDIT: Guess I didn’t attach the picture - updated!