Back to Overview

Maya Control Curve UI

Tools & Techart Topics

This started as a project to pick up Python and PyQt again. The UI will allow the user to save created controls to reload them on other projects but also to create text controls and set the color.

The saved control will create a Python file which is able to recreate the controls cv's on the origin of the scene, create the degree and knots, create periodic curves and combine several shapes into one.

There have been additions made to the tool over time to grab a screenshot from the curve in the viewport and also allows the user to save the hierarchy of controls when they are parented.

The convenience of this tool is that you can easily create high quality controls for rigs, but also store and use the controls as Python files for automated rigging setups. I have used it on all my hand-made rigs and is currently part of the tools used in the CGMA rigging course as well.

This shows the module that is able to grab a screenshot from a viewport embedded into a Qt widget:

viewport

# create paneLayout
paneLayoutName = cmds.paneLayout("test")

#get Qt pointer
ptr = OpenMayaUI.MQtUtil.findControl(paneLayoutName)
paneLayout = wrapinstance(long(ptr))

# get maya modelPanel based on camera
cameraName = cmds.camera()[0]
cmds.hide(cameraName)
modelPanelName = cmds.modelPanel(label="modelPanelName", cam=cameraName, mbv=False)
mel.eval('modelPanelBarDecorationsCallback("GridBtn","%s", "%s|modelEditorIconBar");'%(modelPanelName, modelPanelName))

# get modelPanel Qt pointer (this is the part that can be attached to a qt window)
ptr = OpenMayaUI.MQtUtil.findControl(modelPanelName)
modelPanel = wrapinstance(long(ptr))

# some cleanup of the model view
cmds.modelEditor( modelPanelName, edit = True, displayAppearance='smoothShaded', lw=2)
cmds.viewFit( cameraName, all=True )
barLayout = cmds.modelPanel(modelPanelName, q=True, bl=True)

# cleanup of the menu bar above the vieport
ptr = OpenMayaUI.MQtUtil.findControl(barLayout)
barLayout = wrapinstance(long(ptr))

children =  barLayout.children()
if default == "pyqt4":
    sip.delete(children[0])