Custom Blender UI element with custom design


(Mythenmetz) #1

Hello everybody,

Is it possible to add a custom UI element to Blender with a custom, Python-defined design? For me that sounds like quite a basic task regarding how deep Python integration in Blender has gone. But I did not find any handy solution…

Thanks very much in advance!
Mythenmetz

PS: Yes, that is part of the same project I asked a question a few days ago ( https://blenderartists.org/forum/showthread.php?417493-The-simple-Way-for-adding-a-Sound-Meter ; without reply yet), but (obviously) a totally different problem.


(VincentG) #2

I see two ways to add custom UI element in Blender:

  1. OpenGL: you can draw with the opengl wrapper https://docs.blender.org/api/2.78b/bgl.html
    The preferred method because you do not need external libraries and this is very well integrated into Blender

  2. Use external UI libraries like Qt and GTK.
    It could not be easy to implement and will require a different setup/binary installation on each OS.


(Mythenmetz) #3

Hm, for 2. I have basically no idea on how to tell Blender that my new Qt or GTK-widget exists or how to integrate it in the Blender interface. I understand how to draw using 1., but there stays the problem on how to tell the Blender GUI layout system that a new widget exists. That is important because otherwise my addon cannot know where to draw the widget without possibly overdrawing another one.

The basic workaround would be to design a widget that does not integrate in the UI but is drawn on fixed coordinates somewhere on screen. That could become let’s say context-dependent annoying.


(VincentG) #4

If your talking about widgets like button, dropdown, checkbox, etc : you can’t create a new type from the bpy api.