Can't texture paint a specific texture; it appears as a mask over all other textures (2.79) This is a very weird question, I'm aware :)
I have several meshes, each with its own material, each material with its own texture. This is for a game mod, so they're all simple diffuse textures. I used texture painting to mark the different parts of my texture on some objects. At some point, texture painting stopped working* on a particular object (let's call it object X).
*stopped working = I can paint the texture in the UV editor (Paint mode), but I can't paint the model in the 3D view.
After a bit of frustrated trial and error, I tried texture painting a different object, and... it turns out that on any other object the image of object X's texture appears as a &quot;mask&quot;! What I mean is that, if object Y has a green texture and I paint it with a large red &quot;draw&quot; brush, object Y's texture becomes red where object X's texture is not white, but remains untouched where X's texture is white.
I'm pretty new to texture painting, so I probably did something wrong without noticing. It looks like somehow X's texture has become a sort of &quot;global&quot; mask, but I can't find anything like that anywhere.
I also thought that it may be caused by X's texture having a non-completely-white alpha channel, but after filling it nothing changed. The mask effect seems to be based on the white pixels in that texture. Also, the issue was there also before I edited the image with GIMP, and back then it had no alpha channel.
How can I fix this issue?
EDIT
Here is a minimal file that shows the bug:

There are two objects, one of which cannot be painted (but its texture can be edited with the &quot;mask&quot; tool), the other one can be painted but the texture of the first object is applied as a mask.
I also noticed that, if I paint on the second object with the &quot;mask&quot; tool, then the first object's texture is modified.
In the N panel &gt; Tool &gt; Masking, you've enabled Stencil Mask option, disable it.