Also avoid looping over all objects for texture paint checks when a material changes, only check active object.