Implementing libmypaint

There are not many traditional animation software that let you do bitmap animation and I think this is one of the strength of Pencil. However the current brush engine in Pencil is quite bad in my opinion. I have never managed to get a nice looking stroke with the pencil tool, even on my cintiq tablet.

I think there is no need to re-invent the wheel when there are many existing free libraries.

It is why I plan to learn a bit more about libmypaint (the library doesn’t seam too complicated to implement) and see if I can implement it in Pencil.

MyPaint brush engine is very good and it would make Pencil the perfect tool to make sketched and rough animations.

The lib is here.

This already has been discussed before…
The idea is really good but we need people able to do it :slight_smile:
So, you’ve got programming skills ? This would be awesome !

Yes, I have some programming skills. Time is what’s missing the most at the moment.

A good brush engine would make this software perfect to draw background scenes within the sofware as well. It is a must have!

I managed to build the lib in QT-Creator but integrating it with UI elements is still a bit complicated for me as I am not very familiar with the QT API. If anybody wants to help, that would be great! :wink:

Hey,

Things are going forward for me. I have managed to implement the lib in a small test app I did with QT-Creator. The brush engine works well (shape, opacity, color, pressure…) and I have understood how to make the link between libmypaint and the QT UI API.

The only problem I get so far is that the lines I draw are not smooth at all. We have the same problem with the current brush engine in pencil. It is due to the noise produced by the coordinates precision of the tablet when I move the pen.

As you can see, the lines are very jaggy. I am investigating this. It is maybe something I will have to implement myself if the lib doesn’t handle it.

As soon as I have fixed this problem, I will start to implement the lib to Pencil. The brush tool in bitmap mode will display a list of brush forms to chose from. It should be very good! :slight_smile:

 

[UPDATE] : Actually, I’m wrong! There is some smoothing handling already implemented in Pencil. That’s very good! So I may implement the feature in Pencil straight away.

This is (will be) awesome !
@chchwy : this should interest you.

So, once it is implemented,

If libmypaint is updated, will it be easy to updade it in Pencil2D to be “synced” ?

Yes, I will work on replacing the current brush methods in Pencil (paint a stroke, set color etc…) with the methods from my interface between libmypain and Pencil. I should be able to add the brush selector with all the brushes from mypain quite easily when all this is done.

I guess it will make Pencil much more interesting for artists.

I realize I didn’t reply to your question.

It should be easy to update the lib as long as they don’t modify the API bits we are using. If the calls are the same, we just need to replace the files and rebuild Pencil.

@chchwy, I will need your help with knowing where things are in the current code of pencil to implement the brush lib. I won’t need much but knowing where the code that draws the stroke on the screen is. I’ll overwrite it when the bitmap brush tool is selected. (we may get rid of the pencil and pen tools when on a bitmap layer as they will be part of the brush sub-menu selection)

I will do it on my git branch.

Well, I currently find it very complicated to implement the mypaint brush engine because the code of the current engine is quite complicated and I am not very familiar with it. I struggle with finding how things are painted on the screen.

I am working on an interface between libmypaint and QT that would be independent to Pencil. This way, it can make things easier to implement libmypaint even if we decide to refactor the code of the project at some point. I know @chchwy was planning it some time ago.

I will make my libmypaint -> QT interface a proper project on github so it may get some attention and some contribution.

I’ll keep trying to understand the code of Pencil! :wink:

Good luck man! All of us here a rooting for ya

Sorry for the late reply, I have been very buzy lately. So here are some updates.

I have tried to integrate libmypaint directly into pencil be replacing the current pencil stroke rendering engine. The way Pencil brush engine is coded right now makes it very difficult to do what I tried to do and I havn’t been able to do it.

I thought it would be an easy task but it is not. I don’t want to go into some crazy complex code right now. I guess pencil will need to be refactored to allow that.

In order to make things easier in the case we dicide to refactor Pencil or if someone wants to play with it, I have put together an interface to easily integrate libmypaint in any QT based application. It is here on github.

For now, I think I’d better do bug fixes.

Oww…
This is so sad :slight_smile:
But it still is a good step.
Maybe later then.
Thanks, @feeef !

Imprint