Though its name is ‘selection mask’, many times what we want is select area out from layer, not put a mask on it. So I want request another selection display mode:
Show color as selection, transparent as non-selection.
Then make an action/tool with this (or other) display mode:
Press once, enter global selection mask, then use brush paint area you need. Press again, quit selection mask, active previous layer, show selection in ants line.
But there’s another issue here: mask/selection alpha map.
Currently krita maps grey scale to alpha, you use white/black to add/remove selection. It would be better to use brush alpha instead, so color is not relevant, no need to change color, you can paint and erase as normal, only opacity, brush tip etc affect selections.
Summary
a) New selection mask display mode, show selection not mask.
b) Action/tool with shortcut to quickly toggle paint selection.
c) Selection mask use brush/color alpha not grey scale.
Use brush or color alpha, it would be the same when you do normal painting, just set opacity to which level you want or use semi-transparent brush preset.
You can try this sample script.
Create a new image, open menu tool > scripts > scripter, in opened window, paste the code and press ‘run’ (that triangle button).
This would assign a shortcut ‘A’ for quickly toggle selection mask, press ‘a’, use brush to paint area you want, press ‘a’ again, it would change to selection (show as ants line).
from krita import *
from PyQt5.QtCore import *
def do(id):
app = Krita.instance()
app.action(id).trigger()
prev_color = None
def switchcolor():
global prev_color
app = Krita.instance()
window = app.activeWindow()
view = window.activeView()
color = view.foregroundColor()
if prev_color:
view.setForeGroundColor(prev_color)
prev_color = None
else:
prev_color = color
c = ManagedColor("RGBA", "U8", "")
comp = c.components()
comp[-1] = 1.0
c.setComponents(comp)
view.setForeGroundColor(c)
def active_mask():
app = Krita.instance()
doc = app.activeDocument()
layers = doc.topLevelNodes()
for layer in layers:
if layer.type() == 'selectionmask':
doc.setActiveNode(layer)
def paint_selection():
app = Krita.instance()
doc = app.activeDocument()
on = app.action('show-global-selection-mask').isChecked()
qDebug(str(on))
if not on:
if doc.selection():
do('invert_selection')
else:
do('select_all')
do('show-global-selection-mask')
switchcolor()
QTimer.singleShot(200, active_mask)
else:
switchcolor()
do('switchToPreviouslyActiveNode')
do('show-global-selection-mask')
do('invert_selection')
app = Krita.instance()
window = app.activeWindow()
action = window.createAction('another_selection')
action.setShortcut('a')
action.triggered.connect(paint_selection)
It’s the same as normal painting, you can use a 50% opacity brush to do some painting, the result image look how transparent to you, it’s the level when selection will be.
50% twice would be 100% color, in normal layer mode.
I agree that it would be really more user friendly too if artists had a mode to paint on the local selection layer like they’re used to painting on the paint layers
@fizzyflower@hulmanen
I realised that it’s not a good idea to change what selection mask means.
I have made a simple plugin for this. I still want krita have this function as a tool.
I’ll mark this as a (not perfect) solution to this request.
After seeing your plugin implementation in the linked thread, I think this can really be a separate selection tool. We already have counterpart selection tools of the drawing tools like rectangle selection tool, ellipse selection tool, It would make sense to have a Freehand brush selection tool. And it looks quiet handy from the video you posted in the other thread.
I would suggest you to add the video in this feature request too to make it more clear and edit the text too.
Yes, or blur selections and use levels to round out the corners, or add noise to them etc. the usual things you can do with global selection mask as well. (I think!)
Yes that would be great too. But I think as a selection tool, freehand selection brush is good option. The features you are suggesting will be appropriate to a selection layer type, where you can manipulate it as you can do to a normal paint layer, which as you said is already there as global selection mask. May be in addition to the selection brush tool, we could request the enhancement the global selection mask to have copy pasting feature.
You can already paste into the global selection mask, using “paste into” or whatever it was called. I think filters work too, not 100% sure, but you can’t select things in the selection mask to e.g. transform them. And of course, the colours are inverted from what I prefer, which I think this was about originally?
Posted a request for this a few days ago, and then realised that, it’s not a good idea to modify selection mask. I make this plugin to use a paint layer for selection. It works (though not perfectly).
I still want krita implement this as a default tool.
This is the video from that post showing how the tool works -
So you paint with a paint brush and it turns what you painted into a selection. Selection Mask and editing an exisiting mask by painting on it is a different thing. Just like you draw a rectangle to get a rectangle selection immediately.