Better way to deal with multiple set material nodes

Ether use functions or macros to mask messiness