Is it possible to create viewport widgets with draw handler?

I have an operator which produces simple mesh geometry, I use operator redo properties panel to edit the result as shown in animation below:

operator props

But I want to draw on-screen property widgets in the viewport, like so:

2d widgets

Would this kind of functionality be possible using modal operator and draw handler?

Also is it possible to create 3D widgets similar way?

3d widgets

  • $\begingroup$ These addons can draw some additional UI in the viewport, though they are not interactive I think. Maybe exploring their source code will help you attain what you need blenderartists.org/forum/… $\endgroup$ May 19, 2017 at 19:06
  • $\begingroup$ @DuarteFarrajotaRamos thanks, I already looked into various add-ons, and the only add-on that might hold the answer is Motion Trails, but it's 2k lines of badly structured code, I doubt I can make sense of it. $\endgroup$ May 20, 2017 at 7:38
  • 1
    $\begingroup$ Somewhat Related in that it uses bgl to overdraw 3d views when mousing over the simple rectangular "button". However it is my belief that bgl is going to be dropped from 2.8. $\endgroup$
    – batFINGER
    May 20, 2017 at 9:30
  • $\begingroup$ @batFINGER thatnks! This is is actually what I was looking for! I already made code that creates working slider, and this code add's region detection to it. $\endgroup$ May 21, 2017 at 7:06


You must log in to answer this question.

Browse other questions tagged .