def showUI(model, ikfk_attr, uihost, fks, ik, upv, ikRot, *args):
        # type: (pm.nodetypes.Transform, str, str, List[str], str, str, *str) -> None

        try:
            for c in pyqt.maya_main_window().children():
                if isinstance(c, IkFkTransfer):
                    c.deleteLater()

        except RuntimeError:
            pass

        # Create minimal UI object
        ui = IkFkTransfer()
        ui.setModel(model)
        ui.setUiHost(uihost)
        ui.setSwitchedAttrShortName(ikfk_attr)
        ui.setCtrls(fks, ik, upv, ikRot)
        ui.setComboObj(None)
        ui.setComboBoxItemsFormList(["IK", "FK"])

        # Delete the UI if errors occur to avoid causing winEvent
        # and event errors (in Maya 2014)
        try:
            ui.createUI(pyqt.maya_main_window())
            ui.show()

        except Exception as e:
            import traceback
            ui.deleteLater()
            traceback.print_exc()
            mgear.log(e, mgear.sev_error)
Ejemplo n.º 2
0
    def setup_channelWranglerWindow(self):
        self.mayaMainWindow = pyqt.maya_main_window()

        self.setObjectName(self.toolName)
        self.setWindowFlags(QtCore.Qt.Window)
        self.setWindowTitle("Channel Wrangler")
        self.resize(750, 525)
Ejemplo n.º 3
0
    def setup_componentSettingWindow(self):
        self.mayaMainWindow = pyqt.maya_main_window()

        self.setObjectName(self.toolName)
        self.setWindowFlags(QtCore.Qt.Window)
        self.setWindowTitle(TYPE)
        self.resize(280, 350)
Ejemplo n.º 4
0
    def __init__(self, guide_name="", parent=pyqt.maya_main_window()):
        super(DuplicateSymOptions, self).__init__(parent)

        self.setWindowTitle("Duplicate Symmetrical Options")
        self.setWindowFlags(self.windowFlags()
                            ^ QtCore.Qt.WindowContextHelpButtonHint)

        self.guide_name = guide_name

        self.create_widgets()
        self.create_layout()
        self.create_connections()
        self.option = 0  # cancel
    def doItByUI(self):
        # type: () -> None

        # gather settings from UI
        startFrame = self.startFrame_value.value()
        endFrame = self.endFrame_value.value()
        onlyKeyframes = self.onlyKeyframes_check.isChecked()

        # main body
        self.transfer(startFrame, endFrame, onlyKeyframes, self.hasIkRot)

        # set the new space value in the synoptic combobox
        if self.comboObj is not None:
            self.comboObj.setCurrentIndex(self.comboBoxSpaces.currentIndex())

        for c in pyqt.maya_main_window().children():
            if isinstance(c, anim_utils.AbstractAnimationTransfer):
                c.deleteLater()
Ejemplo n.º 6
0
def write_data_file(file_path, data={}, force=False):
    '''Write data to file

    # kwargs:
    file_path: the file path to write to
    data: the data to write
    f (bool): force write mode, if false, will ask for confirmation when
    overwriting existing files
    '''

    # Ask for confirmation on existing file
    if os.path.exists(file_path) and not force:
        decision = basic.promptAcceptance(pyqt.maya_main_window(),
                                          "File already exists! Overwrite?",
                                          "YOU SURE?")
        if decision in [
                QtWidgets.QMessageBox.Discard, QtWidgets.QMessageBox.Cancel
        ]:
            return

    # write file
    _exportData(data, file_path)