Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """--------------------------------------------------------------------------------------[ IMPORTS ]----------------------------------------------------------------------------------------"""
- #--[ modulos ]--#
- # modulos de maya, python y pyside
- import maya.OpenMayaUI as OpenMayaUI
- from PySide import QtCore, QtGui
- from shiboken import wrapInstance
- import maya.cmds as cmds
- # propios
- import setupTools_UIs.createRibbon_Qt as customUI # modulo .ui complilado a .py
- import setupTools.riggingTools as riggingTools; reload (riggingTools)
- #--[ class objects ]--#
- genericRiggingTools = riggingTools.GenericRiggingTools()
- """--------------------------------------------------------------------------------------[ CLASSES ]-----------------------------------------------------------------------------------------"""
- # vars
- windowName = "createRibbonWindow"
- # pointer to maya window
- def mayaMainWindow():
- ptr = OpenMayaUI.MQtUtil.mainWindow()
- return wrapInstance(long(ptr), QtGui.QWidget)
- class ControlMainWindow(QtGui.QMainWindow):
- def __init__(self, parent=None):
- super(ControlMainWindow, self).__init__(parent)
- self.setWindowFlags(QtCore.Qt.Tool)
- self.ui = customUI.Ui_ribbonTool_win()
- self.ui.setupUi(self)
- #--[ connect functionality ]--#
- self.ui.createRibbon_btn.clicked.connect(self.linkFunction)
- def linkFunction(self):
- #--[ set UI args as method args ]--#
- # side
- side = self.ui.side_cmbBox.currentText()
- if side == "right":
- side = "r"
- if side == "left":
- side = "l"
- if side == "center":
- side = "c"
- # limb name
- limbName = self.ui.limbName_lnEdt.text()
- # joints n�
- jntNumber = self.ui.joints_spnBox.value()
- # shapers n�
- shpNumber = self.ui.shapers_spnBox.value()
- #--[ input args in method ]--#
- genericRiggingTools.createRibbon(side,limbName,jntNumber,shpNumber)
- # cierro si existe ya UI
- if cmds.window(windowName, exists=True):
- cmds.deleteUI(windowName, wnd=True)
- # show UI
- myWin = ControlMainWindow(parent=mayaMainWindow())
- myWin.setObjectName(windowName)
- myWin.show()
Advertisement
Add Comment
Please, Sign In to add comment