Krita to Blender GreasePencil ToolBox

I started working on a project involving both Krita and Blender grease pencil. I’m planning to share the artistic part on this topic

But in the mean time, I have to develop some tools to make it possible. They may not be interesting for anyone but me for the moment, as it is very messy and not use friendly at all, but just in case, I will share my work here.

For the moment it is just a collection of pythons function to ease the workflow between the two software.

Here are the stuff that can be expect from the krita part of the toolbox:

  • Auto convert every paint layer into fill layer (good enough for me)
  • Auto convert every Fill layers into Vector Layers (good enough for me)
  • Auto Rename layers depending on they place in the hierarchy tree and the alpha inheritancy (good enough for me)
  • Auto export Filllayers to a .svg file, with name, color and stroke informations ( color export is buggy,hue and saturation OK, but value is way too low)
  • Based on specific naming, Automatically upload a child alpha based on one or several parents alpha (draft/buggy)

The blender part of the toolbox:

  • place all the curves imported as SVG into a single Gpencil or more based on parameters, with automatic name and mask based on those created by the krita fonction.

The git repository is here

I repeat that it is not user friendly at all and that you cannot expect anything from it without getting into the code for the moment. I also have to warn that one week ago, I didn’t knew python. So watching this code may burn your eyes!

9 Likes

Guau!!! so cool
The idea is make the animation first in krita , then export to blender???

Thank’s a lot!

I’m still discovering the possibilities of the software, but the way I see it, It would more be a back and forth between both Blender and krita:
1- 2D layout would me made in krita then converted as blender GP, maybe with a first 2D rough animation pass.
2- Then the first pass of clean animation would be made with grease pencil. As this pass would only include shape animation, using vector and the possibilties of blender Gpencil seems to be a better choice to me.
3-Then a lighting and shadow animation would be made in krita, as the idea is to get a more painted/volumetric/ organic render on this pass.
4-Then compositing would be made in blender, applying the painted light & shadows as map, and translating the krita filters I used into blender compositing nodes.

I’ll will soon (probably in a few hours) post a breakdown of the test scene concept I’m working which I hope will make this way more clear.
edit: I have in the WIP section

2 Likes

After the desing, you could share with the blender forum to have more feedback

This seems really promising i would love to see how it works then. I have been working on something and I haven’t had time to check this out properly yet.

Thanks a lot for the support. I’m planning on sharing it on the Blender forum too soon.

As I almost ended up rewriting a function I already made these morning, I did a bit of tidy and completed the read-me file.

I will edit the first post to add the list of the functions and their description.

edit: I’m apparently too new to the forum to edit my first post, so here is the list of the functions:

LIST OF KRITA’S FUNCTION

COMPLEX KRITA FUNCTION

def getSvgFromFillLayers(keepVectorLayer = False):

  • get the svg of all the fill layer saved in a file, with the colordata passed
    this part is buggy as color are way to dark for the moment

SIMPLE KRITA FUNCTION

def cleanFillLayer(fillLayer,threshold = True, tValue = 128):

  • remove any pixel informations from outside the document area
    can apply a threshold to sharp edges
    if so, remove pixel painted under the given value

def getColorInfo(fillayer)->str:

  • return the color of a filllayer as ‘#xxxxxx’ str

def getLayerPrefix(layer, getAlphaInherit = False) -> str :

  • get the prefix of a layer in the form “1-1-n(…)n-@” as str

def getVectorLayerSVG(layer,setName=True,setFillColor=False,fillColorHex=“none”, setStrokeColor=False, strokeColorHex = “none”):
* Get the svg body of a vector layer
possibility to override stroke and fill status and color

def replaceAlpha(layerName, selection):
* replace the alpha of a filllayer concidering a selection

def scanLayers(layerGroup=“none”,lType=“all”, tag=“none”,visibility=“all”):

  • return a list of layer based on a serie of filter:
    from a layer group or every layers if “none”
    from a specified type
    having specific str in their name
    from visible or not or all

PYTHON FUNCTION

def convertXMLColorToHex( xml:str) -> str:

  • convert an xml color to an hexa code “#xxxxxx

def createSVGFile(body):

  • add header and end blises to a svg body

def saveTxtToFile(txt, name, format=".txt", writingMethod =“a” ):

  • save a str into a file

def strSearchNReplace(string : str, start : str, stop : str, body : str) -> str:

  • replace in a str a sequence by another

Nice, I hope the sketching (with magnetic sides) to be possible to implement. That one is on of my favorites so far. image

1 Like

This looks so promising, hopefully you will keep working on this. I’m also using both GP and Krita and would be really happy if art could go both directions. Big thumbs up for your project!