Expose events to Python: "tool changed", "brush changed", "foreground color changed", "background color changed"
Why?
For my addons I was using polling before, but that is waaay too slow. You'd think a 10ms timer that just checks a flag would be fast, well you'd be wrong.
I tried to capture inputs and react to every mouse and keyboard button up/down, but it is a glitchy mess.
The thing I actually want is to just get reliably informed when these things change.
What for?
I use my own addons to do:
- remember and restore color per tool brush and/or preset
- "notify" (tiny little text bubble next to cursor) on tool or brush preset switch so I immediately know what I "have in my hand" now
- have a custom OKHSL color picker; but without polling at 10 or 50ms all the time and lag my brush strokes
- more addons I want to make that all would need super ugly hacky workarounds
But they'd all require super hacky ugly workarounds. Meanwhile the events are already fully implemented in krita and perfectly available, just not exposed...
Tests?
Yes, look at changed files.
Edited by Moritz Staudinger