I have a similar problem. If you can take an image file as your mask, you can use a shader like this one:
shader_type canvas_item;
uniform sampler2D mask;
void fragment() {
vec4 color = texture(TEXTURE, UV);
vec4 vmask = texture(mask, UV);
color.a = vmask.a;
COLOR = color;
}
And paste it into a .shader file.
You first have to create a ShaderMaterial for the object you want to mask, then drag the shader file in the shader parameter, then click on the shader param, and finally drag the image into the mask parameter.
You can do the same thing in code by writing
$my_node.material = ShaderMaterial.new()
$my_node.material.shader = preload("res://mask_shader.shader")
$my_node.material.set_shader_param("mask", preload("res://my_mask.png"))
Now, if you need to use drawn shapes as your mask, then I'm just as stuck as you are. You have to turn your drawn shapes into a texture first, and I have yet to find a viable solution to that...
Good luck to you, hope this helps :)