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

  • 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/… – Duarte Farrajota Ramos May 19 '17 at 19:06
  • @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. – Mikhail Rachinskiy May 20 '17 at 7:38
  • 1
    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. – batFINGER May 20 '17 at 9:30
  • @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. – Mikhail Rachinskiy May 21 '17 at 7:06

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.