def getDock(name='LightingManagerDock'):
"""
This function creates a dock with the given name.
It's an example of how we can mix Maya's UI elements with Qt elements
Args:
name: The name of the dock to create
Returns:
QtWidget.QWidget: The dock's widget
"""
# First lets delete any conflicting docks
deleteDock(name)
# Then we create a workspaceControl dock using Maya's UI tools
# This gives us back the name of the dock created
ctrl = pm.workspaceControl(name, dockToMainWindow=('right', 1), label="Lighting Manager")
# We can use the OpenMayaUI API to get the actual Qt widget associated with the name
qtCtrl = omui.MQtUtil_findControl(ctrl)
# Finally we use wrapInstance to convert it to something Python can understand, in this case a QWidget
ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
# And we return that QWidget back to whoever wants it.
return ptr
评论列表
文章目录