コード例 #1
0
ファイル: qt_handlers.py プロジェクト: dieulinh/anim_picker
def unwrap_instance(qt_object):
    '''Return pointer address for qt class instance
    '''
    if globals().has_key('sip'):
        return long(sip.unwrapinstance(qt_object))
    elif globals().has_key('shiboken'):
        return long(shiboken.getCppPointer(qt_object)[0])
コード例 #2
0
ファイル: bdMultiBlast.py プロジェクト: Mortaciunea/bdScripts
	def __init__( self, parent = pyside_util.get_maya_window(), *args ):

		super( MultiBlastUI, self ).__init__( parent )
		self.setupUi( self )
		self.setWindowTitle( '{0} {1}'.format( WINDOW_TITLE, str( WINDOW_VERTION ) ) )
		#self.mayaFilesTableWidget.itemDoubleClicked.connect( self.bdToggleFile )
		self.mayaFilesPathBtn.clicked.connect(lambda: self.bdGetPath('maya'))
		self.blastsPathBtn.clicked.connect(lambda: self.bdGetPath('avi'))
		self.camPathBtn.clicked.connect(lambda: self.bdGetPath('cam'))
		self.rigPathBtn.clicked.connect(lambda: self.bdGetPath('rig'))
		self.playblastBtn.clicked.connect(self.bdPlayblastFolder)
		self.mayaFilesTableWidget.itemDoubleClicked.connect( self.bdToggleStatus )
		self.formatComboBox.currentIndexChanged.connect(self.bdFormatChanged)
		
		self.lastVersion.stateChanged.connect(self.bdGetLastVersion)

		self.mayaFilesTableWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
		self.mayaFilesTableWidget.customContextMenuRequested.connect(self.handleHeaderMenu)

		layout = mui.MQtUtil.fullName(long(shiboken.getCppPointer(self.playblastOptionGrp)[0]))
		formats = pm.playblast(q=1,format=1)
		self.formatComboBox.addItems(formats)
		selectedFormat = self.formatComboBox.currentText()
		cmd = 'playblast -format "' + selectedFormat + '" -q -compression'
		compression = pm.mel.eval(cmd)
		self.encodingComboBox.clear()
		self.encodingComboBox.addItems(compression)
		self.progressBar.hide()
		self.show()
コード例 #3
0
def create(docked=True):
    global dialog

    if dialog is None:
        dialog = LightIt()

    # docking window if statment    
    if docked is True:
        ptr = mui.MQtUtil.mainWindow()
        main_window = shiboken.wrapInstance(long(ptr), qg.QWidget)

        dialog.setParent( main_window )
        size = dialog.size()
        #return proper full name
        name = mui.MQtUtil.fullName(long(shiboken.getCppPointer(dialog)[0]))
        dock = mc.dockControl(
            allowedArea =['right', 'left'],
            area        = 'left',
            floating    = True,
            content     = name,
            width       = size.width(),
            height      = size.height(),
            label       = 'Lighting Tools v1.04')

        # Convert to Dock widget
        widget      = mui.MQtUtil.findControl(dock)
        dock_widget = shiboken.wrapInstance(long(widget), qc.QObject)
        dialog.connectDockWidget( dock, dock_widget )

    else:
        dialog.show()
コード例 #4
0
    def __init__(self, parent=pyside_util.get_maya_window(), *args):

        super(MultiBlastUI, self).__init__(parent)
        self.setupUi(self)
        self.setWindowTitle('{0} {1}'.format(WINDOW_TITLE,
                                             str(WINDOW_VERTION)))
        # self.mayaFilesTableWidget.itemDoubleClicked.connect( self.bdToggleFile )
        self.mayaFilesPathBtn.clicked.connect(lambda: self.bdGetPath('maya'))
        self.blastsPathBtn.clicked.connect(lambda: self.bdGetPath('avi'))
        self.camPathBtn.clicked.connect(lambda: self.bdGetPath('cam'))
        self.rigPathBtn.clicked.connect(lambda: self.bdGetPath('rig'))
        self.playblastBtn.clicked.connect(self.bdPlayblastFolder)
        self.mayaFilesTableWidget.itemDoubleClicked.connect(
            self.bdToggleStatus)
        self.formatComboBox.currentIndexChanged.connect(self.bdFormatChanged)

        self.lastVersion.stateChanged.connect(self.bdGetLastVersion)

        self.mayaFilesTableWidget.setContextMenuPolicy(
            QtCore.Qt.CustomContextMenu)
        self.mayaFilesTableWidget.customContextMenuRequested.connect(
            self.handleHeaderMenu)

        layout = mui.MQtUtil.fullName(
            long(shiboken.getCppPointer(self.playblastOptionGrp)[0]))
        formats = pm.playblast(q=1, format=1)
        self.formatComboBox.addItems(formats)
        selectedFormat = self.formatComboBox.currentText()
        cmd = 'playblast -format "' + selectedFormat + '" -q -compression'
        compression = pm.mel.eval(cmd)
        self.encodingComboBox.clear()
        self.encodingComboBox.addItems(compression)
        self.progressBar.hide()
        self.show()
コード例 #5
0
def create(docked=True):
    global tractor_submit_dialog
    logging.info("create dialog tractor_submit_dialog")
    if tractor_submit_dialog is None:
        tractor_submit_dialog = TractorSubmit()

    if docked is True:
        ptr = mui.MQtUtil.mainWindow()
        main_window = shiboken.wrapInstance(long(ptr), qg.QWidget)

        tractor_submit_dialog.setParent(main_window)
        size = tractor_submit_dialog.size()

        name = mui.MQtUtil.fullName(long(shiboken.getCppPointer(tractor_submit_dialog)[0]))
        dock = mc.dockControl(
            allowedArea=["right", "left"],
            area="right",
            floating=False,
            content=name,
            width=size.width(),
            height=size.height(),
            label="UTS_FARM_SUBMIT",
        )

        widget = mui.MQtUtil.findControl(dock)
        dock_widget = shiboken.wrapInstance(long(widget), qg.QWidget)
        tractor_submit_dialog.connectDockWidget(dock, dock_widget)
    else:
        tractor_submit_dialog.show()
コード例 #6
0
def unwrapinstance(qobject):
    """
    """
    try:
        return long(sip.unwrapinstance(qobject))
    except:
        return long(shiboken.getCppPointer(qobject)[0])
コード例 #7
0
def unwrap_instance(qt_object):
    '''Return pointer address for qt class instance
    '''
    if "sip" in globals():
        return long(sip.unwrapinstance(qt_object))
    elif "shiboken" in globals():
        return long(shiboken.getCppPointer(qt_object)[0])
コード例 #8
0
    def __init__(self, parent=getMayaWindow()):
        self.closeExistingWindow()
        super(facialMaskTool, self).__init__(parent)
        
        self.setupUi(self)
        
        wName = openMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(self)[0]))
        
        self.currentFace = None
        
        ## Connect UI
        ########################################################################
        self.createJointMoverBTN.clicked.connect(self.createJointMoverFn)
        self.showHideAttachBTN.clicked.connect(self.showHideAttachFn)
        
        self.openJointMoverDlgBTN.clicked.connect(self.openJointMoverDlgFn)
        self.openPoseDlgBTN.clicked.connect(self.openPoseDlgFn)
        self.openMaskAlignmentDlgBTN.clicked.connect(self.openMaskAlignmentDlgFn)
        
        self.selectFaceBTN.clicked.connect(self.selectFaceFn)
        self.selectMaskBTN.clicked.connect(self.selectMaskFn)
        self.maskModeBTN.clicked.connect(self.maskModeFn)
        self.constrainToMaskBTN.pressed.connect(self.constrainToMaskFn)
        self.buildBlendBoardBTN.pressed.connect(self.buildBlendBoardFn)
        self.stampDeltasBTN.pressed.connect(self.stampDeltasFn)
        self.mirrorPlacementBTN.pressed.connect(self.mirrorPlacementFn)
        self.deleteSdkParentConstraintsBTN.pressed.connect(self.deleteSdkParentConstraintsFn)

        self.refreshUI()
コード例 #9
0
def create(docked=True):
    global tractor_submit_dialog
    logging.info("create dialog tractor_submit_dialog")
    if tractor_submit_dialog is None:
        tractor_submit_dialog = TractorSubmit()

    if docked is True:
        ptr = mui.MQtUtil.mainWindow()
        main_window = shiboken.wrapInstance(long(ptr), qg.QWidget)

        tractor_submit_dialog.setParent(main_window)
        size = tractor_submit_dialog.size()

        name = mui.MQtUtil.fullName(long(shiboken.getCppPointer(tractor_submit_dialog)[0]))
        dock = mc.dockControl(
            allowedArea =['right', 'left'],
            area        = 'right',
            floating    = False,
            content     = name,
            width       = size.width(),
            height      = size.height(),
            label       = 'UTS_FARM_SUBMIT')

        widget      = mui.MQtUtil.findControl(dock)
        dock_widget = shiboken.wrapInstance(long(widget), qg.QWidget)
        tractor_submit_dialog.connectDockWidget(dock, dock_widget)
    else:
        tractor_submit_dialog.show()
コード例 #10
0
def unwrap_instance(qt_object):
    '''Return pointer address for qt class instance
    '''
    if globals().has_key('sip'):
        return long(sip.unwrapinstance(qt_object))
    elif globals().has_key('shiboken'):
        return long(shiboken.getCppPointer(qt_object)[0])
コード例 #11
0
ファイル: poseManUi.py プロジェクト: skarone/PipeL
	def __init__(self, project, pose = None, parent  = uiH.getMayaWindow() ):
		if uiH.USEPYQT:
			super(base, self).__init__(parent)
		else:
			super(PoseThumbnailCreatorUi, self).__init__(parent)
		self.setupUi(self)
		self.project = project
		self.pose = pose
		layout = mui.MQtUtil.fullName(long(shiboken.getCppPointer(self.viewport_lay)[0]))
		self.cam = mn.Node( 'Capture_Pose' )
		if not self.cam.exists:
			self.camShape = mn.createNode( 'camera', ss = True )
			self.camShape.parent.name = 'Capture_Pose'
			mc.viewSet( self.cam.name, p = True )
			self.cam.shape.a.focalLength.v = 100
			self.cam.a.v.v = 0
		self.executer = mc.modelPanel( mbv = False, camera = self.cam.name, p = layout )
		mc.modelEditor(self.executer, e = True, grid = 0, da = "smoothShaded", allObjects = 0, nurbsSurfaces = 1, polymeshes = 1, subdivSurfaces = 1 )
		#self.viewport_lay.addWidget( uiH.toQtObject( self.executer ) )
		self.setObjectName( 'PoseThumbnailCreatorUi' )
		self._makeConnections()
		self.saveCameraPreset = 0 #READ, 1.. WRITE
		self.settings = sti.Settings()
		gen = self.settings.General
		skin = gen[ "skin" ]
		if skin:
			uiH.loadSkin( self, skin )
		if pose:
			self.poseName_le.setText( pose.name )
		self.fillSections()
コード例 #12
0
def unwrapinstance(*args, **kwargs):
    try:
        import shiboken
    except Exception as e:
        raise ImportError(
            'This method can not be executed without shiboken module.\n{0}'.
            format(e))
    return shiboken.getCppPointer(*args, **kwargs)[0]
コード例 #13
0
def get_cpp_pointer(widget):
    """Convert the cpp pointer of the given widget.

    @param widget the widget
    @return the cpp pointer
    """
    import shiboken
    return long(shiboken.getCppPointer(widget)[0])
コード例 #14
0
ファイル: __init__.py プロジェクト: CRiant/gaffer
def _qtAddress( o ) :

	global __qtModuleName
	if "PyQt" in __qtModuleName :
		import sip
		return sip.unwrapinstance( o )
	else :
		import shiboken
		return shiboken.getCppPointer( o )[0]
コード例 #15
0
ファイル: pyside.py プロジェクト: jonike/Uni-Qt
def unwrapinstance(*args, **kwargs):

    try:
        import shiboken
    except ImportError:
        raise RuntimeError(
            "This method isn't executable without shiboken module.")

    return shiboken.getCppPointer(*args, **kwargs)[0]
コード例 #16
0
ファイル: utils.py プロジェクト: FXTD-ODYSSEY/CommandLauncher
def qtToMaya(widget):
    """
    QWidget -> Maya name

    :param QWidget widget: QWidget of a maya ui object
    :return: Maya name of parsed QWidget
    :rtype: str
    """
    return OpenMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(widget)[0]))
コード例 #17
0
ファイル: __init__.py プロジェクト: mistermatti/gaffer
def _qtAddress( o ) :

	global __qtModuleName
	if "PyQt" in __qtModuleName :
		import sip
		return sip.unwrapinstance( o )
	else :
		import shiboken
		return shiboken.getCppPointer( o )[0]
コード例 #18
0
def interCreate(docked=False):
    deleteFromGlobal()
    global interDialog
    if interDialog is None:
        interDialog = ProShaper()
        if docked:
            ptr = mui.MQtUtil.mainWindow()
            main_window = shi.wrapInstance(long(ptr), qg.QMainWindow)

            interDialog.setParent(main_window)
            size = interDialog.size()

            name = mui.MQtUtil.fullName(long(
                shi.getCppPointer(interDialog)[0]))
            dock = cmds.dockControl(allowedArea=['right', 'left'],
                                    floating=not (docked),
                                    content=name,
                                    width=size.width(),
                                    height=size.height(),
                                    label='Interpolate It',
                                    r=True,
                                    bgc=(0.141, 0.135, 0.135),
                                    ebg=True,
                                    ret=False)
            """ from this is the process to delete the dock from maya window
            before create it again, this way will only appear once in dock panel """
            dockWidget = mui.MQtUtil.findControl(dock)
            dockName = shi.wrapInstance(long(dockWidget), qg.QWidget)
            interDialog.dock_widget = dockWidget
            interDialog.dock_name = dockName
            name = dockName.objectName()

            def changeName(name):
                intNum = int(name[-1])
                if intNum in range(1, 10):
                    preNum = str(intNum - 1)
                    alpha = list(name)
                    alpha[-1] = preNum
                    newName = "".join(alpha)
                    print newName
                    return newName

            oldTool = changeName(name)
            stackDock = 'dockControl5'
            print stackDock

            if oldTool != stackDock[:]:
                try:
                    cmds.deleteUI(oldTool)
                    print('DockControl -- > {} DELETED'.format(oldTool))
                except:
                    pass
            else:
                pass

        else:
            interDialog.show(dockable=True)
 def qt_to_mui(self, qt_obj):
     ref = None
     if qtMode == 0:
         # ==== for pyside ====
         ref = long(shiboken.getCppPointer(qt_obj)[0])
     elif qtMode == 1:
         # ==== for PyQt====
         ref = long(sip.unwrapinstance(qt_obj))
     if ref is not None:
         return mui.MQtUtil.fullName(ref)
コード例 #20
0
ファイル: qt.py プロジェクト: haithan58/guppy_animation_tools
def _pyside():
    """Initialise PySide"""

    import PySide as module
    _setup(module, ["QtUiTools"])

    Qt.__binding_version__ = module.__version__

    try:
        try:
            # Before merge of PySide and shiboken
            import shiboken
        except ImportError:
            # After merge of PySide and shiboken, May 2017
            from PySide import shiboken

        Qt.QtCompat.wrapInstance = (
            lambda ptr, base=None: _wrapinstance(
                shiboken.wrapInstance, ptr, base)
        )
        Qt.QtCompat.getCppPointer = lambda object: \
            shiboken.getCppPointer(object)[0]

    except ImportError:
        pass  # Optional

    if hasattr(Qt, "_QtUiTools"):
        Qt.QtCompat.loadUi = _loadUi

    if hasattr(Qt, "_QtGui"):
        setattr(Qt, "QtWidgets", _new_module("QtWidgets"))
        setattr(Qt, "_QtWidgets", Qt._QtGui)
        if hasattr(Qt._QtGui, "QX11Info"):
            setattr(Qt, "QtX11Extras", _new_module("QtX11Extras"))
            Qt.QtX11Extras.QX11Info = Qt._QtGui.QX11Info

        Qt.QtCompat.setSectionResizeMode = Qt._QtGui.QHeaderView.setResizeMode

    if hasattr(Qt, "_QtCore"):
        Qt.__qt_version__ = Qt._QtCore.qVersion()
        QCoreApplication = Qt._QtCore.QCoreApplication
        Qt.QtCompat.translate = (
            lambda context, sourceText, disambiguation, n:
            QCoreApplication.translate(
                context,
                sourceText,
                disambiguation,
                QCoreApplication.CodecForTr,
                n
            )
        )

    _reassign_misplaced_members("PySide")
    _build_compatibility_members("PySide")
コード例 #21
0
 def __init__(self, parent=getMayaWindow()):
     self.closeExistingWindow()
     super(skinWrangler, self).__init__(parent)
     
     self.setupUi(self)
     self.setWindowTitle(self.title)
     
     wName = openMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(self)[0]))
     
     ## Connect UI
     ########################################################################
     self.connect(self.refreshBTN, QtCore.SIGNAL("clicked()"), self.refreshUI)
     
     #selection buttons
     self.connect(self.selShellBTN, QtCore.SIGNAL("clicked()"), self.selShellFn)
     self.connect(self.selGrowBTN, QtCore.SIGNAL("clicked()"), self.selGrowFn)
     self.connect(self.selShrinkBTN, QtCore.SIGNAL("clicked()"), self.selShrinkFn)
     self.connect(self.selLoopBTN, QtCore.SIGNAL("clicked()"), self.selLoopFn)
     self.connect(self.selPointsEffectedBTN, QtCore.SIGNAL("clicked()"), self.selPointsEffectedFn)
     
     #weight buttons
     self.connect(self.weightZeroBTN, QtCore.SIGNAL("clicked()"), self.weightZeroFn)
     self.connect(self.weightHalfBTN, QtCore.SIGNAL("clicked()"), self.weightHalfFn)
     self.connect(self.weightFullBTN, QtCore.SIGNAL("clicked()"), self.weightFullFn)
     self.connect(self.setWeightBTN, QtCore.SIGNAL("clicked()"), self.setWeightFn)
     self.connect(self.plusWeightBTN, QtCore.SIGNAL("clicked()"), self.plusWeightFn)
     self.connect(self.minusWeightBTN, QtCore.SIGNAL("clicked()"), self.minusWeightFn)
     self.connect(self.copyBTN, QtCore.SIGNAL("clicked()"), self.copyFn)
     self.connect(self.pasteBTN, QtCore.SIGNAL("clicked()"), self.pasteFn)
     self.connect(self.selectVertsWithInfBTN, QtCore.SIGNAL("clicked()"), self.selectVertsWithInfFn)
     self.connect(self.setAverageWeightBTN, QtCore.SIGNAL("clicked()"), self.setAverageWeightFn)
     
     #callbacks on state change
     self.connect(self.jointLST, QtCore.SIGNAL('itemSelectionChanged ()'), self.jointListSelChanged)
     self.connect(self.listAllCHK, QtCore.SIGNAL('stateChanged(int)'), self.listAllChanged)
     self.connect(self.nameSpaceCHK, QtCore.SIGNAL('stateChanged(int)'), self.cutNamespace)
     self.connect(self.skinNormalCMB, QtCore.SIGNAL('currentIndexChanged(int)'), self.skinNormalFn)
     
     #tree filter
     self.connect(self.filterLINE, QtCore.SIGNAL('returnPressed ()'), self.refreshUI)
     self.connect(self.filterBTN, QtCore.SIGNAL("clicked()"), self.refreshUI)
     
     #SKIN UTILS TAB:
     self.connect(self.clampInfBTN, QtCore.SIGNAL("clicked()"), self.clampInfFn)
     self.connect(self.bindPoseBTN, QtCore.SIGNAL("clicked()"), self.bindPoseFn)
     self.connect(self.removeUnusedBTN, QtCore.SIGNAL("clicked()"), self.removeUnusedFn)
     self.connect(self.addJntBTN, QtCore.SIGNAL("clicked()"), self.addJntFn)
     
     #TOOLS TAB
     self.connect(self.jointOnBboxCenterBTN, QtCore.SIGNAL("clicked()"), self.jointOnBboxCenterFn)
     
     print 'skinWrangler initialized as', wName
     self.scriptJobNum = cmds.scriptJob(e=['SelectionChanged', 'skinWranglerWindow.refreshUI()'], p=wName, kws=1)
     self.refreshUI()
コード例 #22
0
ファイル: maya.py プロジェクト: danbradham/hotline
def maya_widget(widget):
    '''QWidget to MayaWidget'''

    from maya.OpenMayaUI import MQtUtil
    try:
        from shiboken import getCppPointer
    except ImportError:
        from shiboken2 import getCppPointer

    pointer = long(getCppPointer(widget)[0])
    path = MQtUtil.fullName(pointer)
    return MayaWidget(path, widget)
コード例 #23
0
def maya_widget(widget):
    '''QWidget to MayaWidget'''

    from maya.OpenMayaUI import MQtUtil
    try:
        from shiboken import getCppPointer
    except ImportError:
        from shiboken2 import getCppPointer

    pointer = long(getCppPointer(widget)[0])
    path = MQtUtil.fullName(pointer)
    return MayaWidget(path, widget)
コード例 #24
0
def GetFullName(qObj):
    if USE_PYQT_MODULE:
        pointer = sip.unwrapinstance(qObj)
    else:
        pointer = long(shiboken.getCppPointer(qObj)[0])
    if type(pointer) == long:
        windowString = mui.MQtUtil.fullName(pointer)
        if windowString:
            return windowString
        else:
            return ''
    else:
        return GetQtWidget(qObj.objectName(), LongName=True)[-1]
コード例 #25
0
 def __init__(self, parent=getMayaWindow()):
     self.closeExistingWindow()
     super(drivenKeyVisualizer, self).__init__(parent)
     
     self.setupUi(self)
     
     wName = openMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(self)[0]))
     
     ## Connect UI
     ########################################################################
     self.connect(self.findDrivenKeysBTN, QtCore.SIGNAL("clicked()"), self.findDrivenKeysFN)
     
     print 'drivenKeyVisualizer initialized as', wName
コード例 #26
0
 def __init__(self, parent=getMayaWindow()):
     self.closeExistingWindow()
     super(drivenKeyVisualizer, self).__init__(parent)
     
     self.setupUi(self)
     
     wName = openMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(self)[0]))
     
     ## Connect UI
     ########################################################################
     self.connect(self.findDrivenKeysBTN, QtCore.SIGNAL("clicked()"), self.findDrivenKeysFN)
     
     print 'drivenKeyVisualizer initialized as', wName
コード例 #27
0
ファイル: qt.py プロジェクト: Temujin2887/mlib
def unwrapinstance(obj):
	"""
	Utility to convert a Qt class instance to a pointer

	:param obj: Object to unwrap
	:type obj: Qt Object
	:return: Unwrapped instance pointer
	:rtype: long
	"""
	if obj is None:
		return
	if qt_lib == 'pyqt':
		return sip.unwrapinstance(obj)
	elif qt_lib == 'pyside':
		return long(shiboken.getCppPointer(obj))
コード例 #28
0
ファイル: qt.py プロジェクト: dannywynne/maya
def unwrapinstance(obj):
    """
	Utility to convert a Qt class instance to a pointer

	:param obj: Object to unwrap
	:type obj: Qt Object
	:return: Unwrapped instance pointer
	:rtype: long
	"""
    if obj is None:
        return
    if qt_lib == 'pyqt':
        return sip.unwrapinstance(obj)
    elif qt_lib == 'pyside':
        return shiboken.getCppPointer(obj)
コード例 #29
0
    def _get_dialog_parent(self):
        """
        Get the QWidget parent for all dialogs created through
        show_dialog & show_modal.
        """
        # Find a parent for the dialog - this should be the RV mainWindow()
        from tank.platform.qt import QtGui
        import shiboken

        ptr = None
        for w in QtGui.qApp.topLevelWidgets():
            if w.inherits("QMainWindow"):
                ptr = shiboken.getCppPointer(w)
        if ptr:
            return shiboken.wrapInstance(long(ptr[0]), QtGui.QMainWindow)
        return None
コード例 #30
0
ファイル: module_test.py プロジェクト: Hasimir/Shiboken
    def testDump(self):
        """Just check if dump doesn't crash on certain use cases"""
        p = ObjectType()
        obj = ObjectType(p)
        obj2 = ObjectType(obj)
        obj3 = ObjectType(obj)
        self.assertEqual(shiboken.dump(None), "Ordinary Python type.")
        shiboken.dump(obj)

        model = ObjectModel(p)
        v = ObjectView(model, p)
        shiboken.dump(v)

        m = MultipleInherited()
        shiboken.dump(m)
        self.assertEqual(len(shiboken.getCppPointer(m)), 2)
コード例 #31
0
    def testDump(self):
        """Just check if dump doesn't crash on certain use cases"""
        p = ObjectType()
        obj = ObjectType(p)
        obj2 = ObjectType(obj)
        obj3 = ObjectType(obj)
        self.assertEqual(shiboken.dump(None), "Ordinary Python type.")
        shiboken.dump(obj)

        model = ObjectModel(p)
        v = ObjectView(model, p)
        shiboken.dump(v)

        m = MultipleInherited()
        shiboken.dump(m)
        self.assertEqual(len(shiboken.getCppPointer(m)), 2)
コード例 #32
0
    def addQWidget_toMayaUI(qWidget, mayaUI=None):

        if not mayaUI:
            mayaUIPointer = long(OpenMayaUI.MQtUtil.getCurrentParent())

        if not mayaUIPointer:
            if not mayaUI == None:
                raise Exception(
                    'No UI specified, and no UI set using the maya setParent command'
                )
            else:
                raise Exception('specified mayaUI was not found')

        mayaUIPointer = long(mayaUIPointer)

        qWidgetPointer = shiboken.getCppPointer(qWidget)[0]
        OpenMayaUI.MQtUtil.addWidgetToMayaLayout(qWidgetPointer, mayaUIPointer)
コード例 #33
0
    def __init__(self, parent=getMayaWindow()):

        self.closeExistingWindow()

        super(facialMaskTool, self).__init__(parent)

        self.setupUi(self)

        wName = openMayaUI.MQtUtil.fullName(
            long(shiboken.getCppPointer(self)[0]))

        self.currentFace = None

        ## Connect UI

        ########################################################################

        self.createJointMoverBTN.clicked.connect(self.createJointMoverFn)

        self.showHideAttachBTN.clicked.connect(self.showHideAttachFn)

        self.openJointMoverDlgBTN.clicked.connect(self.openJointMoverDlgFn)

        self.openPoseDlgBTN.clicked.connect(self.openPoseDlgFn)

        self.openMaskAlignmentDlgBTN.clicked.connect(
            self.openMaskAlignmentDlgFn)

        self.selectFaceBTN.clicked.connect(self.selectFaceFn)

        self.selectMaskBTN.clicked.connect(self.selectMaskFn)

        self.maskModeBTN.clicked.connect(self.maskModeFn)

        self.constrainToMaskBTN.pressed.connect(self.constrainToMaskFn)

        self.buildBlendBoardBTN.pressed.connect(self.buildBlendBoardFn)

        self.stampDeltasBTN.pressed.connect(self.stampDeltasFn)

        self.mirrorPlacementBTN.pressed.connect(self.mirrorPlacementFn)

        self.deleteSdkParentConstraintsBTN.pressed.connect(
            self.deleteSdkParentConstraintsFn)

        self.refreshUI()
コード例 #34
0
    def __init__(self, parent=getMayaWindow()):

        self.closeExistingWindow()

        super(uExportTool, self).__init__(parent)

        self.setupUi(self)

        self.setWindowTitle(self.title)

        wName = openMayaUI.MQtUtil.fullName(
            long(shiboken.getCppPointer(self)[0]))

        ## Connect UI

        ########################################################################

        self.connect(self.export_BTN, QtCore.SIGNAL("clicked()"),
                     self.export_FN)

        self.connect(self.createUexportNode_BTN, QtCore.SIGNAL("clicked()"),
                     self.createUexportNode_FN)

        self.connect(self.replaceUnknownNodes, QtCore.SIGNAL("clicked()"),
                     self.replaceUnknownNodes_FN)

        self.refreshBTN.clicked.connect(self.refreshUI)

        #context menu

        self.export_tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)

        self.connect(self.export_tree,
                     QtCore.SIGNAL("customContextMenuRequested(QPoint)"),
                     self.openMenu)

        self.export_tree.itemClicked.connect(self.check_status)

        self.snapRoot_CMB.setHidden(True)

        self.refreshUI()
コード例 #35
0
 def __init__(self, project, pose=None, parent=uiH.getMayaWindow()):
     if uiH.USEPYQT:
         super(base, self).__init__(parent)
     else:
         super(PoseThumbnailCreatorUi, self).__init__(parent)
     self.setupUi(self)
     self.project = project
     self.pose = pose
     layout = mui.MQtUtil.fullName(
         long(shiboken.getCppPointer(self.viewport_lay)[0]))
     self.cam = mn.Node('Capture_Pose')
     if not self.cam.exists:
         self.camShape = mn.createNode('camera', ss=True)
         self.camShape.parent.name = 'Capture_Pose'
         mc.viewSet(self.cam.name, p=True)
         self.cam.shape.a.focalLength.v = 100
         self.cam.a.v.v = 0
     self.executer = mc.modelPanel(mbv=False,
                                   camera=self.cam.name,
                                   p=layout)
     mc.modelEditor(self.executer,
                    e=True,
                    grid=0,
                    da="smoothShaded",
                    allObjects=0,
                    nurbsSurfaces=1,
                    polymeshes=1,
                    subdivSurfaces=1)
     #self.viewport_lay.addWidget( uiH.toQtObject( self.executer ) )
     self.setObjectName('PoseThumbnailCreatorUi')
     self._makeConnections()
     self.saveCameraPreset = 0  #READ, 1.. WRITE
     self.settings = sti.Settings()
     gen = self.settings.General
     skin = gen["skin"]
     if skin:
         uiH.loadSkin(self, skin)
     if pose:
         self.poseName_le.setText(pose.name)
     self.fillSections()
コード例 #36
0
ファイル: qt_temp.py プロジェクト: sgodanas/scripts
	def __init__(self, parent, **kwargs):
		super(MyDialog, self).__init__(parent, **kwargs)
		print 'here'
		self.setObjectName("MyWindow")
		self.resize(800, 600)
		self.setWindowTitle("PySide ModelPanel Test")

		self.verticalLayout = QtGui.QVBoxLayout(self)
		self.verticalLayout.setContentsMargins(0,0,0,0)

		# need to set a name so it can be referenced by maya node path
		self.verticalLayout.setObjectName("mainLayout")

		# First use shiboken to unwrap the layout into a pointer
		# Then get the full path to the UI in maya as a string
		layout = mui.MQtUtil.fullName(long(shiboken.getCppPointer(self.verticalLayout)[0]))
		print 'layout', layout
		#layout = mui.MQtUtil.fullName(long(shiboken.unwrapInstance(self.verticalLayout)))
		cmds.setParent(layout)

		paneLayoutName = cmds.paneLayout()

		# Find a pointer to the paneLayout that we just created
		ptr = mui.MQtUtil.findControl(paneLayoutName)

		# Wrap the pointer into a python QObject
		self.paneLayout = shiboken.wrapInstance(long(ptr), QtGui.QWidget)

		self.cameraName = cmds.camera()[0]
		self.modelPanelName = cmds.modelPanel("customModelPanel", label="ModelPanel Test", cam=self.cameraName)

		# Find a pointer to the modelPanel that we just created
		ptr = mui.MQtUtil.findControl(self.modelPanelName)

		# Wrap the pointer into a python QObject
		self.modelPanel = shiboken.wrapInstance(long(ptr), QtGui.QWidget)

		# add our QObject reference to the paneLayout to our layout
		self.verticalLayout.addWidget(self.paneLayout)
コード例 #37
0
    def testDump(self):
        """Just check if dump doesn't crash on certain use cases"""
        p = ObjectType()
        obj = ObjectType(p)
        obj2 = ObjectType(obj)
        obj3 = ObjectType(obj)
        self.assertEqual(shiboken.dump(None), "Ordinary Python type.")
        shiboken.dump(obj)

        model = ObjectModel(p)
        v = ObjectView(model, p)
        shiboken.dump(v)

        m = MultipleInherited()
        shiboken.dump(m)
        self.assertEqual(len(shiboken.getCppPointer(m)), 2)

        # Don't crash even after deleting an object
        shiboken.invalidate(obj)
        shiboken.dump(obj)  # deleted
        shiboken.dump(p)    # child deleted
        shiboken.dump(obj2) # parent deleted
コード例 #38
0
    def __init__(self, parent=getMayaWindow()):
        self.closeExistingWindow()
        super(uExportTool, self).__init__(parent)

        self.setupUi(self)
        self.setWindowTitle(self.title)

        wName = openMayaUI.MQtUtil.fullName(long(shiboken.getCppPointer(self)[0]))

        ## Connect UI
        ########################################################################
        self.connect(self.export_BTN, QtCore.SIGNAL("clicked()"), self.export_FN)
        self.connect(self.createUexportNode_BTN, QtCore.SIGNAL("clicked()"), self.createUexportNode_FN)
        self.connect(self.replaceUnknownNodes, QtCore.SIGNAL("clicked()"), self.replaceUnknownNodes_FN)
        self.refreshBTN.clicked.connect(self.refreshUI)

        #context menu
        self.export_tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.connect(self.export_tree, QtCore.SIGNAL("customContextMenuRequested(QPoint)" ), self.openMenu)

        self.export_tree.itemClicked.connect(self.check_status)

        self.snapRoot_CMB.setHidden(True)
        self.refreshUI()
コード例 #39
0
    def add_viewport(self,lyt):
        OldPanels = [itm for itm in cmds.getPanel(type='modelPanel') if 'embeddedModelPanel' in itm]
        model_test = cmds.getPanel(withLabel='modelPanel_UI')

        for panel in OldPanels:
            if (cmds.modelPanel(panel, exists=True)):
                cmds.deleteUI(panel, panel=True)

        try:
            if (cmds.modelPanel(model_test, exists=True)):
                cmds.deleteUI(model_test, panel=True)
        except:
            pass


        lyt.setObjectName("mainLayout")
        layout = mui.MQtUtil.fullName(long(shi.getCppPointer(lyt)[0]))
        #print (layout)
        par = cmds.setParent(layout)
        panel_lyt_name = cmds.paneLayout()
        modelPanelName = "embeddedModelPanel{}".format(random.randrange(101,54612658412196513465))

        ptr = mui.MQtUtil.findControl(panel_lyt_name)
        paneLayout = shi.wrapInstance(long(ptr), qg.QWidget)

        self.UI_camera, self.UI_cameraShape = self.create_camera()

        modelPanel_Name = cmds.modelPanel(modelPanelName, label='modelPanel_UI', cam=self.UI_camera, menuBarVisible=False, init=True)
        cmds.modelEditor(modelPanel=modelPanel_Name,wireframeOnShaded=False,wireframeBackingStore=False,displayTextures=True,subdivSurfaces=False,
                         rnm='base_OpenGL_Renderer',displayAppearance = "smoothShaded", hud=False)

        self.hideIconMenu()
        ptr_01 = mui.MQtUtil.findControl(modelPanel_Name)
        modelPanelExit = shi.wrapInstance(long(ptr_01), qg.QWidget)

        return paneLayout, modelPanel_Name
コード例 #40
0
ファイル: colorUi.py プロジェクト: chippey/rvColorUi
    def __init__(self):
        rvtypes.MinorMode.__init__(self)
        self.init("color-ui", 
                  None, 
                  None,
                  [("color ui",
                    [("color interface", self.showUi,"", None)]
                    )] 
                  )
        
        self.loader = QtUiTools.QUiLoader()
        uifile = QtCore.QFile(os.path.join(self.supportPath(colorUi, "colorUi"), "colorUiGui.ui"))
        uifile.open(QtCore.QFile.ReadOnly)
        self.widgets = self.loader.load(uifile)

        self.colorWheelScale = qtColorWheel.ColorWheelWidget(name='scale')
        self.colorWheelGamma = qtColorWheel.ColorWheelWidget(name='gamma')
        self.colorWheelExposure = qtColorWheel.ColorWheelWidget(name='exposure')
        self.colorWheelOffset = qtColorWheel.ColorWheelWidget(name='offset')
        
        self.widgets.gainWheel.takeAt(0) 
        self.widgets.gainWheel.insertWidget(0,self.colorWheelScale)
        self.widgets.gammaWheel.takeAt(0) 
        self.widgets.gammaWheel.insertWidget(0,self.colorWheelGamma)
        self.widgets.exposureWheel.takeAt(0) 
        self.widgets.exposureWheel.insertWidget(0,self.colorWheelExposure)
        self.widgets.offsetWheel.takeAt(0) 
        self.widgets.offsetWheel.insertWidget(0,self.colorWheelOffset)

        uifile.close()
         
        for w in QtGui.qApp.allWidgets():
            if w.inherits("QMainWindow"):
                ptr = shiboken.getCppPointer(w)
                self.mainWindow = shiboken.wrapInstance(long(ptr[0]), QtGui.QMainWindow)
                self.dialog = QtGui.QDockWidget("color ui", self.mainWindow)
                self.mainWindow.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.dialog)
        self.dialog.setWidget(self.widgets)

        self.active  = self.dialog.findChild(QtGui.QCheckBox, "active")
        self.invert  = self.dialog.findChild(QtGui.QCheckBox, "invert")
        self.createNodesNuke  = self.dialog.findChild(QtGui.QPushButton, "createNodesNuke")
        self.propagateToAllColor = self.dialog.findChild(QtGui.QPushButton, "propagateToAllColor")
        self.getSettingsNuke = self.dialog.findChild(QtGui.QPushButton, "getSettingsNuke")
        self.resetButton = self.dialog.findChild(QtGui.QPushButton, "reset")
        
        self.node = ''
        
        self.normalize  = self.dialog.findChild(QtGui.QCheckBox, "normalize")
        self.scaleCheck  = self.dialog.findChild(QtGui.QCheckBox, "gainCheckbox")
        self.gammaCheck  = self.dialog.findChild(QtGui.QCheckBox, "gammaCheckbox")
        self.exposureCheck = self.dialog.findChild(QtGui.QCheckBox, "exposureCheckbox")
        self.offsetCheck  = self.dialog.findChild(QtGui.QCheckBox, "offsetCheckbox")
        self.saturation = self.dialog.findChild(QtGui.QDoubleSpinBox, "saturation")
        self.gamma = self.findSet(QtGui.QDoubleSpinBox, ["gammaRed", "gammaGreen", "gammaBlue"])
        self.scale = self.findSet(QtGui.QDoubleSpinBox, ["gainRed", "gainGreen", "gainBlue"])
        self.offset = self.findSet(QtGui.QDoubleSpinBox, ["offsetRed", "offsetGreen", "offsetBlue"])
        self.exposure = self.findSet(QtGui.QDoubleSpinBox, ["exposureRed", "exposureGreen", "exposureBlue"])
        
        commands.bind("default", "global", "frame-changed", self.onFrameChangeAndAddSource, 'New frame')
        commands.bind("default", "global", "source-group-complete", self.onFrameChangeAndAddSource, 'New frame')
        #commands.bind("default", "global", "graph-state-change", self.onGraphStateChange, 'New frame')
        #maybe put the update in a thread to get rid of the sluggishness
        
        #connections for the wheels
        self.colorWheelScale.colorSignal.connect(self.changeRvColor)
        self.colorWheelGamma.colorSignal.connect(self.changeRvColor)
        self.colorWheelExposure.colorSignal.connect(self.changeRvColor)
        self.colorWheelOffset.colorSignal.connect(self.changeRvColor)
        
        #connections for the toggle states
        self.scaleCheck.stateChanged.connect(lambda: self.toggleCorrection('scale'))
        self.gammaCheck.stateChanged.connect(lambda: self.toggleCorrection('gamma'))
        self.exposureCheck.stateChanged.connect(lambda: self.toggleCorrection('exposure'))
        self.offsetCheck.stateChanged.connect(lambda: self.toggleCorrection('offset'))
        
        #connections to the helper functions
        self.createNodesNuke.clicked.connect(self.createNodesForNuke)
        self.propagateToAllColor.clicked.connect(self.propagateToAllRvColor)
        self.resetButton.clicked.connect(self.resetAllUi)
コード例 #41
0
    def __init__(self, parent=getMayaWindow()):
        self.closeExistingWindow()
        super(skinWrangler, self).__init__(parent)

        self.setupUi(self)
        self.setWindowTitle(self.title)

        wName = openMayaUI.MQtUtil.fullName(
            long(shiboken.getCppPointer(self)[0]))

        ## Connect UI
        ########################################################################
        self.connect(self.refreshBTN, QtCore.SIGNAL("clicked()"),
                     self.refreshUI)

        #selection buttons
        self.connect(self.selShellBTN, QtCore.SIGNAL("clicked()"),
                     self.selShellFn)
        self.connect(self.selGrowBTN, QtCore.SIGNAL("clicked()"),
                     self.selGrowFn)
        self.connect(self.selShrinkBTN, QtCore.SIGNAL("clicked()"),
                     self.selShrinkFn)
        self.connect(self.selLoopBTN, QtCore.SIGNAL("clicked()"),
                     self.selLoopFn)
        self.connect(self.selPointsEffectedBTN, QtCore.SIGNAL("clicked()"),
                     self.selPointsEffectedFn)

        #weight buttons
        self.connect(self.weightZeroBTN, QtCore.SIGNAL("clicked()"),
                     self.weightZeroFn)
        self.connect(self.weightHalfBTN, QtCore.SIGNAL("clicked()"),
                     self.weightHalfFn)
        self.connect(self.weightFullBTN, QtCore.SIGNAL("clicked()"),
                     self.weightFullFn)
        self.connect(self.setWeightBTN, QtCore.SIGNAL("clicked()"),
                     self.setWeightFn)
        self.connect(self.plusWeightBTN, QtCore.SIGNAL("clicked()"),
                     self.plusWeightFn)
        self.connect(self.minusWeightBTN, QtCore.SIGNAL("clicked()"),
                     self.minusWeightFn)
        self.connect(self.copyBTN, QtCore.SIGNAL("clicked()"), self.copyFn)
        self.connect(self.pasteBTN, QtCore.SIGNAL("clicked()"), self.pasteFn)
        self.connect(self.selectVertsWithInfBTN, QtCore.SIGNAL("clicked()"),
                     self.selectVertsWithInfFn)
        self.connect(self.setAverageWeightBTN, QtCore.SIGNAL("clicked()"),
                     self.setAverageWeightFn)

        #callbacks on state change
        self.connect(self.jointLST, QtCore.SIGNAL('itemSelectionChanged ()'),
                     self.jointListSelChanged)
        self.connect(self.listAllCHK, QtCore.SIGNAL('stateChanged(int)'),
                     self.listAllChanged)
        self.connect(self.nameSpaceCHK, QtCore.SIGNAL('stateChanged(int)'),
                     self.cutNamespace)
        self.connect(self.skinNormalCMB,
                     QtCore.SIGNAL('currentIndexChanged(int)'),
                     self.skinNormalFn)

        #tree filter
        self.connect(self.filterLINE, QtCore.SIGNAL('returnPressed ()'),
                     self.refreshUI)
        self.connect(self.filterBTN, QtCore.SIGNAL("clicked()"),
                     self.refreshUI)

        #SKIN UTILS TAB:
        self.connect(self.clampInfBTN, QtCore.SIGNAL("clicked()"),
                     self.clampInfFn)
        self.connect(self.bindPoseBTN, QtCore.SIGNAL("clicked()"),
                     self.bindPoseFn)
        self.connect(self.removeUnusedBTN, QtCore.SIGNAL("clicked()"),
                     self.removeUnusedFn)
        self.connect(self.addJntBTN, QtCore.SIGNAL("clicked()"), self.addJntFn)

        #TOOLS TAB
        self.connect(self.jointOnBboxCenterBTN, QtCore.SIGNAL("clicked()"),
                     self.jointOnBboxCenterFn)

        print 'skinWrangler initialized as', wName
        self.scriptJobNum = cmds.scriptJob(
            e=['SelectionChanged', 'skinWranglerWindow.refreshUI()'],
            p=wName,
            kws=1)
        self.refreshUI()