Dbus integration to connect with 3D engines

There have been a number of posts asking for some 3D modeling in Krita for the sake of manikins, etc (e.g. [1]), but I have a better idea I think would work. Rather than trying to integrate 3D with Krita, I believe it would be feasible to use dbus to communicate with Blender. This could have the following uses:

  1. Allowing Krita to send image data to Blender to allow for texture painting (something that Blender lacks)
  2. Allowing Blender to send 3D render data (even quick render) to Krita to allow for a “live” manikin edited in Blender.

To implement this, the Python dbus library can be used for both Blender and Krita. You can quickly look up using Python dbus on ChatGPT, so I won’t expand on it here.

The benefits of using this system would be great because then we could take advantage of all each program has to offer. The programs would exchange images, not complex data, data we can stick in a FIFO. If one program changed its data, e.g. moving the camera in Blender, it would notify the other and update the FIFO. Note too that most people would only want the simple object-view or camera view from Blender and not the fancy render (at least not at first).

Using dbus, of course, is limited to *nix distros, but if it’s all Python, then we don’t need to worry about a messy binary on Windows.

Finally, the API development requires knowledge of Blender Python as well. For a more permanent solution, communication with the Blender team would be good, although Blender allows running Python scripts within it, so we could always test things there.

Thoughts? Comments?

[1] 3d models inside krita

:slight_smile: Hello @chronologicaldot, and welcome to the forum!

Do you mean like in these plugins?

Blender Layer - Live 3d View in Krita

Blender Krita Link: plugin for texture editing in krita

Krita Blender Workflow Bridge Plugin, make the transition between Krita and Blender easier

Michelist

1 Like

Yes!
Although it looks like those only work for Windows (or at least only tested on Windows), and I’m on a Linux system.
I’ll have to check those out and respond.

1 Like

The Blender Krita Link plugin is the closest to functionality of what I’m looking for, and the guy says it’ll work on Linux, but unfortunately it requires recompiling Krita from source, so I’ll have to ask him if there’s a purely Pythonic way to do it.

Why use d-bus when a socket connection could do the same on Windows and Linux and would be faster too?

It doesn’t matter that python has a dbus library because the problem is that you can not access all the stuff you need in Krita from python. The python API is very limited and it is very cumbersome to do complex tasks that require access to Krita’s core with python, that’s why they are normally implemented directly at the core in C/C++. For example you could not add a new type of layer or extend an existing one, something you would probably need for a project like this.

Although I use Blender I never did any scripting for it so I can’t tell how feasible it is on their side. It’s just a feeling but I think their python API can do al lot more with the core program compared to Krita.

I can understand that there is a demand for connecting Krita with Blender something I would like to use too, but I doubt it is possible through python plug-ins allone (at least with the current state of Kritas scripting engine).