Making Buttons in the viewport

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/03/2012 at 22:44, xxxxxxxx wrote:

Hi,

Making a plugin based on ObjectData. I want to either create a 3 button widget in the viewport with BaseDraw commands OR be able through code to make a HUD entry of a DropDown Menu.

I've created 3 squares in the viewport with BaseDraw and a handful of DrawLine2D commands. I even have read the mouse x and y from the EditorWindow and I know when the mouse is inside those squares. I have IF statements changing values of description parameters like it should. HOWEVER, because the user is clicking on the viewport, it keeps unselecting the object. So it kind of defeats the purpose of having them be convenient buttons. I then tried forcing it to re-select the object through code which it does for one frame then unselects again. Point is, this whole solution seems hacky.

If I could through code just create a HUD element on INIT, that would be great as well.

The end result is I want an automatic way upon instantiation of the plug-in to have some kind of widget in the viewport to allow the user to switch the 3 modes the plug-in works in.