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
Exemplo n.º 2
0
def getDock(name='RE_ManagerDock'):

    deleteDock(name)
    ctrl = pm.workspaceControl(name,
                               dockToMainWindow=('right', 1),
                               label="RE Engine Tools")
    qtCtrl = omui.MQtUtil_findControl(ctrl)
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return ptr
Exemplo n.º 3
0
def getMainWindow():
    #get a pointer to the maya main window using the main window mqt util
    pointer = mui.MQtUtil.mainWindow()

    #convert the return swig object to its memory location
    convPointer = long(pointer)

    #now store the main window by wrapping it with sip
    mainWindow = sip.wrapInstance(conPointer, QtCore.QObject)
    # now return the main window qobject 
    return mainWindow
def getDock(name='LightingManagerDock'):

    # delete any conflicting docks
    deleteDock(name)
    ctrl = pm.workspaceControl(name,
                               dockToMainWindow=('right', 1),
                               label="Lighting Manager")
    qtCtrl = omui.MQtUtil_findControl(ctrl)

    # wrapInstance used to convert it to something Python can understand, in this case a QWidget
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)

    return ptr
def getMayaMainWindow():
    """
    Since Maya is Qt, we can parent our UIs to it.
    This means that we don't have to manage our UI and can leave it to Maya.
    Returns:
        QtWidgets.QMainWindow: The Maya MainWindow
    """
    # We use the OpenMayaUI API to get a reference to Maya's MainWindow
    win = omui.MQtUtil_mainWindow()
    # Then we can use the wrapInstance method to convert it to something python can understand
    # In this case, we're converting it to a QMainWindow
    ptr = wrapInstance(long(win), QtWidgets.QMainWindow)
    # Finally we return this to whoever wants it
    return ptr
Exemplo n.º 6
0
def getMayaMainWindow():
    """
    Since Maya_tk is Qt, we can parent our UIs to it.
    This means that we don't have to manage our UI and can leave it to Maya_tk.
    Returns:
        QtWidgets.QMainWindow: The Maya_tk MainWindow
    """
    # Use the OpenMayaUI API to get a reference to Maya_tk's MainWindow
    win = omui.MQtUtil_mainWindow()

    # Use the wrapInstance method to convert it to something python can understand (QMainWindow)
    ptr = wrapInstance(long(win), QtWidgets.QMainWindow)

    # Return this to whoever wants it
    return ptr
Exemplo n.º 7
0
def getDock(name='DAMGtoolBoxIIIDock'):
    """
    This function creates a dock with the given name.
    It's an example of how we can mix Maya_tk's UI elements with Qt elements
    Args:
        name: The name of the dock to create
    Returns:
        QtWidget.QWidget: The dock's widget
    """
    # Delete any conflicting docks
    deleteDock( name )

    # Create a workspaceControl dock using Maya_tk's UI tools
    ctrl = cmds.workspaceControl(name, label='DAMG Tool Box III - All About Lighting')

    # Use the OpenMayaUI API to get the actual Qt widget associated with the name
    qtCtrl = omui.MQtUtil_findControl(ctrl)

    # Use wrapInstance to convert it to something Python can understand (QWidget)
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return ptr
def getMayaMainWindow():

    win = omui.MQtUtil_mainWindow()
    ptr = wrapInstance(long(win), QtWidgets.QMainWindow)
    return ptr
 def mayaToQT( name ):
     # Maya -> QWidget
     ptr = omui.MQtUtil.findControl( name )
     if ptr is None:         ptr = omui.MQtUtil.findLayout( name )
     if ptr is None:         ptr = omui.MQtUtil.findMenuItem( name )
     if ptr is not None:     return wrapInstance( long( ptr ), QWidget )
Exemplo n.º 10
0
 def wrapinstance(ptr):
     return sip.wrapInstance(long(ptr), QtCore.QObject)