How to disable painting foliage on an object such as rock?

Hi, as the title says, I want to disable painting grass foliage on the rock below. When I paint on it then the grass is so weird just like in the image below.
Making invisible the object (rock) doesn’t work. Thanks.

in the painting section there are check box’s, one of them is static mesh. untick it and you wont get grass on your rocks.

Thank you very much, it works. Now, I don’t need to move the object temporary when I want to paint foliage behind it.