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 CLOSED
 
Thread Tools Search this Thread Display Modes
  12 December 2010
Creating a floating button inside the viewport

Hi,

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 | arondurkin.com | Twitter | Linkedin
 
  12 December 2010
I agree, but it will do.
Thanks.
 
  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.setText('testing!')
myBtn.move(100, 100) #Relative to top-left corner of viewport
myBtn.show()


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.
__________________
www.nathanhorne.com - 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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 09:39 PM.


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