def readLDNMode(): """ """ UIContainer.pref = Preference.Preference() if UIContainer.pref.ldnMode == 'translate': cmds.menuItem(UIContainer.menuItemLDNTranslation, e=True, radioButton=True) cmds.menuItem(UIContainer.menuItemLDNRotation, e=True, radioButton=False) cmds.menuItem(UIContainer.menuItemLDNBoth, e=True, radioButton=False) elif UIContainer.pref.ldnMode == 'rotate': cmds.menuItem(UIContainer.menuItemLDNTranslation, e=True, radioButton=False) cmds.menuItem(UIContainer.menuItemLDNRotation, e=True, radioButton=True) cmds.menuItem(UIContainer.menuItemLDNBoth, e=True, radioButton=False) elif UIContainer.pref.ldnMode == 'both': cmds.menuItem(UIContainer.menuItemLDNTranslation, e=True, radioButton=False) cmds.menuItem(UIContainer.menuItemLDNRotation, e=True, radioButton=False) cmds.menuItem(UIContainer.menuItemLDNBoth, e=True, radioButton=True)
def writeDCNMode(mode, *args): """ """ UIData.pref = Preference.Preference() UIData.pref.dcnMode = mode UIData.pref.construct() UIData.pref.write()
def writeLDNMode(mode, *args): """ """ UIContainer.pref = Preference.Preference() UIContainer.pref.ldnMode = mode UIContainer.pref.construct() UIContainer.pref.write()
def writeACSMode(mode, *args): """ """ UIContainer.pref = Preference.Preference() UIContainer.pref.acsMode = mode UIContainer.pref.construct() UIContainer.pref.write()
def writeEIBMode(mode, *args): """ """ UIData.pref = Preference.Preference() UIData.pref.eibMode = mode UIData.pref.construct() UIData.pref.write()
def writeMGLMode(mode, *args): """ """ UIContainer.pref = Preference.Preference() UIContainer.pref.mglMode = mode UIContainer.pref.construct() UIContainer.pref.write()
def readMGLMode(): """ """ UIContainer.pref = Preference.Preference() if UIContainer.pref.mglMode == 'constraint': cmds.menuItem(UIContainer.radioMenuItemModeCont, e=True, radioButton=True) cmds.menuItem(UIContainer.radioMenuItemModeBake, e=True, radioButton=False) cmds.menuItem(UIContainer.radioMenuItemModeDrive, e=True, radioButton=False) elif UIContainer.pref.mglMode == 'bake': cmds.menuItem(UIContainer.radioMenuItemModeCont, e=True, radioButton=False) cmds.menuItem(UIContainer.radioMenuItemModeBake, e=True, radioButton=True) cmds.menuItem(UIContainer.radioMenuItemModeDrive, e=True, radioButton=False) elif UIContainer.pref.mglMode == 'driver': cmds.menuItem(UIContainer.radioMenuItemModeCont, e=True, radioButton=False) cmds.menuItem(UIContainer.radioMenuItemModeBake, e=True, radioButton=False) cmds.menuItem(UIContainer.radioMenuItemModeDrive, e=True, radioButton=True)
def readDCNMode(): """ """ UIData.pref = Preference.Preference() if UIData.pref.dcnMode == 'pose': UIData.menuPose.setChecked(True) UIData.menuAnim.setChecked(False) elif UIData.pref.dcnMode == 'anim': UIData.menuPose.setChecked(False) UIData.menuAnim.setChecked(True)
class UIData(): """ """ slider = None labelMode = None eibMode = None floatSliderEIBAmount = None menuObject = None menuKeyFrame = None menuLinear = None popupMenu = None pref = Preference.Preference()
class UIContainer(): """ """ undoChunk = False dragInProgress = False objs = False animCurves = None animCurveInfo = {} #dict {animcurve : []} animCurveCalculatedInfo = {} floatSliderEIBAmount = None radioMenuItemModeObject = None radioMenuItemModeKeyFrame = None pref = Preference.Preference()
def readACSMode(): """ """ UIContainer.pref = Preference.Preference() if UIContainer.pref.acsMode == 'pose': cmds.menuItem(UIContainer.radioMenuItemACSModePose, e=True, radioButton=True) cmds.menuItem(UIContainer.radioMenuItemACSModeAnim, e=True, radioButton=False) elif UIContainer.pref.acsMode == 'anim': cmds.menuItem(UIContainer.radioMenuItemACSModePose, e=True, radioButton=False) cmds.menuItem(UIContainer.radioMenuItemACSModeAnim, e=True, radioButton=True)
def readLDNMode(): """ """ UIData.pref = Preference.Preference() if UIData.pref.ldnMode == 'translate': UIData.menuTr.setChecked(True) UIData.menuRo.setChecked(False) UIData.menuBo.setChecked(False) elif UIData.pref.ldnMode == 'rotate': UIData.menuTr.setChecked(False) UIData.menuRo.setChecked(True) UIData.menuBo.setChecked(False) elif UIData.pref.ldnMode == 'both': UIData.menuTr.setChecked(False) UIData.menuRo.setChecked(False) UIData.menuBo.setChecked(True)
def readMGLMode(): """ """ UIData.pref = Preference.Preference() if UIData.pref.mglMode == 'constraint': UIData.menuConstraint.setChecked(True) UIData.menuBake.setChecked(False) UIData.menuDriver.setChecked(False) elif UIData.pref.mglMode == 'bake': UIData.menuConstraint.setChecked(False) UIData.menuBake.setChecked(True) UIData.menuDriver.setChecked(False) elif UIData.pref.mglMode == 'driver': UIData.menuConstraint.setChecked(False) UIData.menuBake.setChecked(False) UIData.menuDriver.setChecked(True)
def drawArc(*args): """ Motion trail """ from animBuddy import Preference reload(Preference) UIContainer.pref = Preference.Preference() Core.run(dotSize=UIContainer.pref.dotSize, keyFrameSize=UIContainer.pref.keyFrameSize, timeBuffer=UIContainer.pref.timeBuffer, lineWidth=UIContainer.pref.lineWidth, lineColor=UIContainer.pref.lineColor, dotColor=UIContainer.pref.dotColor, keyFrameColor=UIContainer.pref.keyFrameColor, style=UIContainer.pref.mtStyle)
def __init__(self, parent=None, name=None): super(MToolBar, self).__init__() filePath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) imagesPath = os.path.join(filePath, 'images') iconSize = 30 self.pref = Preference.Preference() self.setObjectName(name) self.setMinimumHeight(40) mainLayout = QtWidgets.QHBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignRight) self.setLayout(mainLayout) #- Line Width lineLayout = QtWidgets.QHBoxLayout() labelline = QtWidgets.QLabel() labelline.setText('Line ') buttonLine = self.createButton(attr='line', color=self.pref.lineColor) buttonLine.show() self.sliderLine = ASlider.ASlider( colorEnum="pgreen", width=150, height=15, handleSticked=False, presetsShow=False, minValue=0, maxValue=20, startValue=self.pref.lineWidth, presetsStep=1, trail=False, ) self.sliderLine.valueChanged.connect(self.lineWidthCB) lineLayout.addWidget(labelline) lineLayout.addWidget(buttonLine) lineLayout.addWidget(self.sliderLine) #- Dot size dotLayout = QtWidgets.QHBoxLayout() labelDot = QtWidgets.QLabel() labelDot.setText(' Dot ') buttonDot = self.createButton(attr='dot', color=self.pref.dotColor) buttonDot.show() self.sliderDot = ASlider.ASlider( colorEnum="pgreen", width=150, height=15, handleSticked=False, presetsShow=False, minValue=0, maxValue=20, startValue=self.pref.dotSize, presetsStep=1, trail=False, ) self.sliderDot.valueChanged.connect(self.dotSizeCB) dotLayout.addWidget(labelDot) dotLayout.addWidget(buttonDot) dotLayout.addWidget(self.sliderDot) #- Keyframe size keyframeLayout = QtWidgets.QHBoxLayout() labelKeyframe = QtWidgets.QLabel() labelKeyframe.setText(' Keyframe ') buttonKeyframe = self.createButton(attr='keyFrame', color=self.pref.keyFrameColor) buttonKeyframe.show() self.sliderKeyframe = ASlider.ASlider( colorEnum="pgreen", width=150, height=15, handleSticked=False, presetsShow=False, minValue=0, maxValue=20, startValue=self.pref.keyFrameSize, presetsStep=1, trail=False, ) self.sliderKeyframe.valueChanged.connect(self.keyframeSizeCB) keyframeLayout.addWidget(labelKeyframe) keyframeLayout.addWidget(buttonKeyframe) keyframeLayout.addWidget(self.sliderKeyframe) #- Timebuffer size timebufferLayout = QtWidgets.QHBoxLayout() labelTimebuffer = QtWidgets.QLabel() labelTimebuffer.setText('Timebuffer ') buttonTimebuffer = self.createButton(attr='traveler', color=self.pref.timeBufferColor) buttonTimebuffer.show() self.sliderTimebuffer = CSlider.CSlider( colorEnum="pgreen", width=150, height=15, handleSticked=False, presetsShow=False, minValue=0, maxValue=20, startValue=self.pref.timeBuffer, presetsStep=1, trail=False, ) self.sliderTimebuffer.valueChanged.connect(self.timeBufferCB) timebufferLayout.addWidget(labelTimebuffer) timebufferLayout.addWidget(buttonTimebuffer) timebufferLayout.addWidget(self.sliderTimebuffer) #- Style comboBoxStyle = QtWidgets.QComboBox(self) comboBoxStyle.addItem("Single") comboBoxStyle.addItem("Double") comboBoxStyle.activated[str].connect(self.styleCB) index = comboBoxStyle.findText(self.pref.mtStyle, QtCore.Qt.MatchFixedString) if index >= 0: comboBoxStyle.setCurrentIndex(index) mainLayout.addLayout(lineLayout) mainLayout.addWidget(Separator.separator(vertical=True)) mainLayout.addLayout(dotLayout) mainLayout.addWidget(Separator.separator(vertical=True)) mainLayout.addLayout(keyframeLayout) mainLayout.addWidget(Separator.separator(vertical=True)) mainLayout.addLayout(timebufferLayout) mainLayout.addWidget(Separator.separator(vertical=True)) mainLayout.addWidget(comboBoxStyle) # close button iconImagePath = os.path.join(imagesPath, 'close.png').replace('\\', '/') iconHoverImagePath = os.path.join(imagesPath, 'close_hi.png').replace('\\', '/') button = QtWidgets.QPushButton('') button.clicked.connect(cleanUI) button.setToolTip("Closing Toolbar") button.setStyleSheet(''' QPushButton{image:url(%s); border:0px; width:%s; height:%s} QPushButton:hover{image:url(%s); border:0px;} QPushButton:pressed { background-color: rgba(0, 255,255, 10);} ''' % (iconImagePath, iconSize, iconSize, iconHoverImagePath)) button.show() mainLayout.addWidget(button)
class UIContainer(): """ """ pref = Preference.Preference()