Creating a floating button inside the viewport

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  12 December 2010
Creating a floating button inside the viewport


I've seen somewhere someone who customized his own buttons inside a scene. They appear inside the viewport, and rendered orthogonal (2D image) always at the same place - aren't influence by the camera movements.

Is there a quick way to do that, maybe an already made script (everything goes, but preferably in pymel)?
  12 December 2010
theres hudButton in mel, but its not very versatile, i'd love a better alternative myself
Aron Durkin - Animator / Co-Founder Super Spline Studios
Super Spline Studios | Twitter | Linkedin
  12 December 2010
I agree, but it will do.
  12 December 2010
You can use geometry but there are some issues with triggering commands based on selection and the undo queue. If you want to go that route, I would suggest looking into zooHud and zooTriggers (Part of the zooToolbox)

If you are wanting actual GUI control parented to the viewport, mel only offers hudslider, hudbutton, and headsUpMessage.

You can also use PyQt and parent in your own custom widgets/layouts or whatever you want using something like this:

import maya.OpenMayaUI as apiUI
import sip

from PyQt4 import QtGui

view = apiUI.M3dView()
apiUI.M3dView.getM3dViewFromModelPanel('modelPanel  4', view)
viewWidget = sip.wrapinstance(long(view.widget()), QtCore.QObject)

global myBtn
myBtn = QtGui.QPushButton(viewWidget)
myBtn.move(100, 100) #Relative to top-left corner of viewport

You can do anything a full qt widget can do with that, so it's extremely flexible. but it would require having PyQt installed, which can be a barrier depending on your tools distribution.
__________________ - Technical Artist
  12 December 2010
Interesting. Thanks, I'll check it out.
  12 December 2010
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:36 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.