MaskLayer: StencilMask Toggle for Current Layer/frames in TVPaint 11
Posted: 26 May 2021, 21:24
The MaskLayer Script for TVPaint 11.x Users
The MaskLayer Script provides a three way toggle for users of TVPaint 11 that works almost exactly like old TVPaint 10Stencil Mask did. Normally, the Stencil Mask is off. Direct drawing on the current layer/frames works as expected. When the MaskLayer Script is toggled, any pixels on the current layer/frame will act as a mask. Of course, the transparency of each pixel will be reflected in the opacity or partial transparency of the Stencil Mask. The presence of the masked pixel areas will show as a soft gray checkboard (you will still be able to see the pixels). When the MaskLayer Script button is toggled again, the Stencil Mask is inverted so that the soft gray checkerboard indicates the background, non-pixel areas of the screen that are protected from being drawn upon. Partially transparent pixels will have partial inverted masking as well. When the MaskLayer Script is toggled a third time, the Stencil Mask is removed so the artist returns to drawing normally, over background and existing pixels.
How the MaskLayer Script Works
First press of the MaskLayer Script button creates a duplicate of all frames for the current layer and positions this layer copy at the bottom of the layer stack. It also deactivates the visibility of that layer and assigns the Stencil Mask to ON INVERT so that the copied layer can act as a perfect mask to the existing pixels as the artist can draw under them on any selected frame of the current layer.Pressing the MaskLayer Script again deletes the existing MaskLayer after noting the state of the Stencil setting. A new MaskLayer is created and moved to the bottom layer position. The new copy is based on updated drawings of current layer's pixels and the new Stencil Mask is assigned ON NORMAL so that the background surrounding the pixels can act as a new perfect mask for drawing over any existing pixels on any and all frames of the current layer.
WARNING: IF no pixels exist for any frame of the active layer, the Stencil Mask completely protects the entire frame making it impossible to draw on it. In that case a popup message warns the user that the blank frame cannot be drawn on. Pressing the MaskLayer Script again simply deletes the existing MaskLayer and the artist can draw on the current layer frames in a normal way.
MaskLayer Script Notes:
Remember that any newly drawn pixels on the current layer will become part of future mask contours on the next toggle.
The user is responsible for toggling the mask state: Off, Invert, Normal. But the MaskLayer Script will do the housekeeping as to the presence of the MaskLayer and its Stencil status.
Toggling the MaskLayer Script works best when assigned to a shortcut key. The transparent gray checkboard gives a subtle visual indication of the mask state, inverted or normal, or not present.
When the MaskLayer button is toggled to off, the temporary layer at the bottom of the layer stack is deleted (not saved with the project).
SECOND REMINDER: Once created, the StencilMask for the original layer IS STILL PRESENT AND REMAINS ACTIVE WHEN YOU CHANGE LAYERS, SO YOU MUST REMEMBER TO TAB THE MASK LAYER OFF (or shut it off manually), OR IT WILL PROBABLY ADVERSELY AFFECT DRAWING ON OTHER LAYERS! On the positive side, the mask is still visible because of the gray checkerboard pattern... you will know exactly where the still active mask is in effect, AND this gives you an easy way to create a multiframe mask that could prove useful when working on different layers...