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
Ejemplo n.º 2
0
def getDock(name='CoutureDock'):
    """
    Get the ptr to a dockable location for Couture
    @param name: str, name of the Couture dockable window
    @return ptr: ptr the dock windows newly created
    """

    deleteDock(name)

    if maya_api_version() < MAYA2017:
        ctrl = pm.dockControl(name,
                              area='right',
                              content='Couture',
                              allowedArea='all',
                              label="Couture tool",
                              vis=True,
                              r=True)
        print "do ctrl"

        # And then we return the control name
        return ctrl

    else:
        # ctrl = pm.workspaceControl(name, dockToMainWindow=('right', 1), label="Couture tool")
        ctrl = pm.workspaceControl(name,
                                   dockToMainWindow=('right', 1),
                                   label="Couture tool",
                                   loadImmediately=True,
                                   vis=True,
                                   r=True)
        qtCtrl = omui.MQtUtil_findControl(ctrl)
        ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)

        return ptr
Ejemplo n.º 3
0
def fetch_maya_statusline_toolbox():
    status_line = mel.eval('$tmp = $gStatusLineForm')
    pointer = omui.MQtUtil_findControl(status_line)
    status_line = wrapInstance(long(pointer), QtWidgets.QWidget)
    toolbox = status_line.children()[1].children()[2]

    return toolbox
Ejemplo n.º 4
0
def getDock(name='LightingManagerDock'):
    deleteDock(name)
    ctrl = pm.workspaceControl(name,
                               dockToMainWindow=('right', 1),
                               label="Lighting Manager")
    qtCtrl = omui.MQtUtil_findControl(ctrl)
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return ptr
Ejemplo n.º 5
0
def getDock(name='poseLibraryDock'):
    deleteDock(name)
    ctrl = pm.workspaceControl(name,
                               ttc=("AttributeEditor", -1),
                               label='Pose Library')
    qtCtrl = omui.MQtUtil_findControl(ctrl)
    pointer = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return pointer
Ejemplo n.º 6
0
def getDock(name='PickerUIDock'):
    deleteDock(name)
    # Creates and manages the widget used to host windows in a layout
    # which enables docking and stacking windows together
    ctrl = cmds.workspaceControl(name, dockToMainWindow=('right', 1), label='Picker UI')
    # we need the QT version, MQtUtil_findControl return the qt widget of the named maya control
    qtCtrl = OpenMayaUI.MQtUtil_findControl(ctrl)
    # translate to something python understand
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)

    return ptr
Ejemplo n.º 7
0
def getDock(name='LightingManagerDock'):
    # Delete dock with same name if it exists
    deleteDock(name)
    # Create a new dock control
    ctrl = pm.workspaceControl(name,
                               dockToMainWindow=('right', 1),
                               label="Lighting Manager")
    # Get the memory address of control
    qtCtrl = omui.MQtUtil_findControl(ctrl)
    # Convert it to an instance and convert it to long and convert to a regular widget
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return ptr
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
Ejemplo n.º 9
0
def getDock(wrap, name, label):
    if cmds.workspaceControl(name, query=True, exists=True):
        cmds.deleteUI(name)
    ctrl = cmds.workspaceControl(name,
                                 r=True,
                                 rs=True,
                                 floating=True,
                                 label=label)
    # tabToControl=('ChannelBoxLayerEditor', 1)
    # dockToMainWindow=("right", True)
    qtCtrl = omui.MQtUtil_findControl(ctrl)
    ptr = wrapInstance(long(qtCtrl), wrap)
    return ptr
Ejemplo n.º 10
0
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
    """
    # delete any conflict dock
    deleteDock(name)
    # name of the dock created
    ctrl = pm.workspaceControl(name,
                               dockToMainWindow=('right', 1),
                               label="Lighting Manager")
    qtCtrl = omui.MQtUtil_findControl(ctrl)

    # conver to something python can understand
    ptr = wrapInstance(long(qtCtrl), QtWidgets.QWidget)
    return ptr
Ejemplo n.º 11
0
def getDock(name='DAMGtoolBoxIIDock', version=VERSION):
    """
    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
    """
    # Delete any conflicting docks
    deleteDock(name)
    # Create a workspaceControl dock using Maya_tk's UI tools
    if version >= 2017:
        ctrl = cmds.workspaceControl(name, label='Split Joint')
    else:
        ctrl = cmds.dockControl(name, label='Split Joint')
    # 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