I have not tested but this method does not fit me. I have hundred object in scene and set material action for permodel is a huge and dull task..