This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shiboken2 import wrapInstance | |
from builtins import int | |
import maya.cmds as cmds | |
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin | |
WORKSPACE_CTRL_NAME = 'CustomWidgetWorkspaceControl' | |
WIDGET_OBJECT_NAME = 'CustomWidget' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Maya Python API 1.0 | |
""" | |
import sys | |
import maya.OpenMayaMPx as mpx | |
import maya.OpenMaya as om | |
pluginName = 'pyTemplate' | |
sampleShortFlagName = '-s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.api.OpenMaya as om | |
import sys | |
nodeName = 'myFirstNode' | |
nodeID = om.MTypeId(0x55555) | |
nodeClassify = 'utility/general' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
import maya.cmds as cmds | |
import maya.OpenMaya as om | |
import maya.OpenMayaMPx as mpx | |
nodeName = 'myFirstDeformer' | |
nodeID = om.MTypeId(0x55555) | |
class MyDeformer(mpx.MPxDeformerNode): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyTableWidgetItem(QtWidgets.QTableWidgetItem): | |
def __init__(self, parent=None): | |
QtWidgets.QTableWidgetItem.__init__(self, parent) | |
def __lt__(self, otherItem): | |
try: | |
return int(self.text().split('-')[0]) < int(otherItem.text().split('-')[0]) | |
except ValueError: | |
return self.text() < otherItem.text() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainUI(QtWidgets.QMainWindow): | |
def __init__(self, parent=getMainWindow()): | |
super(MainUI, self).__init__(parent) | |
list = ['apple', 'banana', 'pear'] | |
dialog = CustomDialog() | |
dialog.setNamespaceCBox(list) | |
# only when self.accept() is returned | |
# need close event to return self.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainWidget(QtWidgets.QMainWindow): | |
def __init__(self, parent=None): | |
self.connectSignal() | |
def connectSignal(self): | |
self.someBtn.clicked.connect(self.openCustomWidget) | |
def openCustomWidget(self): | |
# initialize with a widget and a layout | |
self.customWidget = QtWidgets.QWidget() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyButton(QtWidgets.QPushButton): | |
right_clicked = QtCore.Signal() | |
left_clicked = QtCore.Signal() | |
double_clicked = QtCore.Signal() | |
def __init__(self, *args, **kwargs): | |
super(MyButton, self).__init__(*args, **kwargs) | |
self.timer = QtCore.QTimer() | |
self.timer.setSingleShot(True) |
OlderNewer