4

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

Mikhail Rachinskiy
  • 1,069
  • 8
  • 22
  • 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 https://blenderartists.org/forum/showthread.php?407260-AddOn-NP-Point-Copy – 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 07: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 09: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 07:06

0 Answers0