This is my first attempt at doing something custom in Krita. I have had some success getting the plug-in to register, being able to trigger it with a keyboard shortcut etc but I ran in to a strange issue where, even though I have an if-else-statement in my method the action will do both of the things, regardless of the condition that I’m trying to establish. So… basically it does both the ‘if’ part as well as the ‘else’ part…
Could anyone please try out this plug-in and have a look at the code? I apologize for the tremendous redundancy in the script. I am definitely going to delete unnecessary stuff once I get it to work.
What the plug-in is supposed to do:
- check which tool is active
- if the freehand selection tool is active, fill selection with FG color
- if freehand selection tool is not active, activate it (but NOT fill selection with FG color)
(this is what I’m having problems with… when the freehand selection tool is not selected, it selects it AND fills with FG color)
Here’s the part of the code that seems to be causing problems… Or maybe it’s something else?
if name == 'KisToolSelectOutline': Krita.instance().action('fill_selection_foreground_color').trigger() elif name != 'KisToolSelectOutline': Krita.instance().action('KisToolSelectOutline').trigger()
So essentially my goal is to create the possibility to use conditional hotkeys. Depending on which tool is active, the hotkeys should change. At least that’s the idea, but I’m still in the beginning of figuring this out… And again the problem is that regardless of whether the Freehand Selection tool is active or not it always fills with FG color. It should only fill with FG color when the Freehand Selection Tool is active. Otherwise it should activate the Freehand Selection tool.