Are specific brush option [opacity,size,flow,soft] pressure toggle available via python

It’s working now thank you. :blush:

Might not be the best approach but it works.

My laptop is a bit slow. Tested on 5.1.0 pre-alpha.

7 Likes

Glad to see you’ve been able to reach your goal :slight_smile:

Grum999

@kaichi1342 : Congratulations, you have done well! I consider it very useful. :+1:

Michelist

:blush: thank you. this is making delve to pyqt. right now im looking at qtimers.
I’m thinking if theres other simple thing i can add for my workflow. :joy:

i use it extensively last night while sketching and blocking. so im very happy.

image

this is going to be my last update here. I did went ahead and added a control for InputHFade.
Also learned to use QTimer, so now if a brush is selected its current toggles and if fade exist are reflected without pressing the previous load brush button.

Also made it 4 side by side because i want it to be as small as possible.

simple functionality - but exactly what i was looking for a few months ago.
[works for my use case] .

4 Likes

This is a small and useful plug-in. Do you plan to share it in the future?

2 Likes

I have not think about it. I was mainly doing this to solve a usability issue im having which i have discuss on previous thread.

if im going to release it as plugin / i might need to allow other to add/remove other property they can toggle such as rotation, the 4 here are chosen based solely on what i use.

Its also feels very hacky. :sweat_smile: the whole idea is to programmatically walk and activate the property on brush editor without opening it because currently there is no way to directly call it.
Everytime something is activated the traverse function is called to locate where it is in the brush editor [idk how taxing that is].

but if someone want it at its current state - i’ll provide it to them [once im sure it has no bug].
been using it to 2 sketch session and have greatly enjoyed ^-^ its presense.

3 Likes

Often time free software projects are born out of necessity of the authors own workflow requirements. They release the software as is. If people need improvement and feature they will contribute :slight_smile: so don’t worry about it and release the plugin if you wish to.

2 Likes

:sweat_smile:

Hello again, kinda need help here. So I add a force check the listview if the property in the list view is uncheck and toggle the checkbox of usecurve after/ so that it fully activates the pressure.

model.setData(m_index, Qt.Checked, Qt.CheckStateRole)

Now im having problem with this. It works as intended and check the list view checkbox it just somehow resets the brush size.

i tried mending by recording the size before toggle, then re-assigning it but it seems the
re-assigment of the size happened before the resets.

i tried forcing a fix size to see what happening.

example fix brush size is 100, current size is 400 and default size is 12.

what happen is the brush size goes 100 for brief moment then 12 after.

even if setBrushSize is called after the above line. :sweat_smile:
if I remove those line brush size dont default and also get reassigned if i need them.

last thing i notice is if open the brush editor , do a few toggle then close it. this issue gets resolved.

so im bit lost.

ill try see if setting the size by manually setting the size slider, the way I do the fade, will work.

By size do you mean the diameter or some option under Size checkbox? In general, many things are behind signals that tell the whole program things were changed, While some signals are built-in when you set the value, others have to be emitted manually. Otherwise, they will not be in sync with the changes.

Im sorry about that.

I mean the diameter of the brush. :sweat_smile:

I’m trying to keep the size/diameter of the brush after toggle.

So you are mix and matching Krita API with modification of QT directly? The Krita API is no stranger to a few race conditions here and there. Why not just already use setValue?

There is also things like qApp.processEvents() which can help deal with some race conditions.

1 Like

its not that im mix and match.

its that im trying to resolve the brush diameter resetting to default after

model.setData(m_index, Qt.Checked, Qt.CheckStateRole)

I have not really read much. Currently the only one i know to set brush size / diameter is by
setBrushSize. so what im doing is setting the diameter value to the value i save before i call the above line.

I look into setValue.

Thank you.

I really wish people would first consider extending libkis (and the sip bindings) before digging through krita’s QObject hierarchy. As a development team we’re not exactly difficult to get to accept merge requests…

Hi

For sure, everyone (I mean at least every plugin’s developer here) want’s to see API being improved instead of tweaking QObject hierarchy.

I already made some proposal here on KA and in phabricator.

And I perfectly understand that API improvement is not the priority, especially according to available budget and developers.


But talking from my own experience, my fork of Krita’s repository is in a state I’m not able to understand; I’m not able to update it, I’m not able to fix it. First and last time I tried to do a MR, finally it was made by you because I was not able to fix my repository and MR was impossible to do.

And then as I already spent too much time to try to understand what happen and what to do without being able to fix anything, I dropped the idea to try to work on that :man_shrugging:

For example this simple bug that can be fixed with one line of code, I’m just unable to commit that on my repository :woozy_face:

Shame on me.

But on my side I like to code, not to fight with git :slight_smile:

Working 10~12hours a day at the office, my free-time is precious.
So on my side, writing plugins, alone on my repository is the fastest and easiest way I have to try to contribute without blowing my mind with git stuff (in addition than trying to help people here, doing recurrent donation, testing alpha&beta, taking time to open bugs…)

Don’t know for other plugin’s developers, I remember @KnowZero and @slightlyangrydodo already made some commit in code to facilitate development for their plugin, but it is not necessarily easy for everyone…

(sorry, a little bit off-topic according to original topic)

Grum999

2 Likes

I would want to do that, but i dont think I’m at the level where I can even touch the libkis yet.

if I could make this small docker with a simpler code and not relying on traversing QObjects I would. For now , for what i need, my skill level and knowledge - this is all i can understand and do.

Speaking of which, I have solve it now.

you are right, shouldve not mix/match krita api with the qt.

i just set radius the same way i set horizontal fade. so the only call for krita api i have in this is for saving brush name.

I agree that would be preferable, and I totally agree speaking from experience that the developer team has been excellent with helping out with merge requests and have been extremely friendly.

But there are 3 things to consider:

  1. The python api is still bound by versions right? So any api changes would have to wait for 5.1 from what I understand?

  2. People don’t always feel comfortable touching the main code base right off the bat. Hacking around the QObject system gives people opportunity to learn Krita’s structure and QT’s structure so that given time they feel more comfortable contributing. Not just by expanding the python API but Krita as a whole.

  3. It also allows for quick prototyping as well. While in C++ we can make direct changes, in Python we can make changes without restarting Krita or recompiling it.

Don’t worry, I assure you as people get more and more used to using python API, they will eventually contribute by expanding not only the API, but Krita as a whole. The first step is to get people hooked :wink:

That developers can definitely help with. I previously only worked with git by simply dumping things to a repository and calling it a day. So when I did one of my MR’s trying to amend it, I totally messed up and screwed up my repo by overwriting someone else’s previous commit. The devs were very friendly helping with that.

Now I can do things like splitting commits or modifying previous ones with no issue. One thing I did find a lot easier to do when making selective commits or simply amending the last commit is simply typing: git gui

3 Likes