def snapshot(self):
        """
        :raise: AnimationPluginError
        """
        startFrame, endFrame = mutils.selectedFrameRange()
        if startFrame == endFrame:
            self.validateFrameRange()
            endFrame = self.endFrame()
            startFrame = self.startFrame()

        self.showByFrameDialog()

        try:
            step = self.byFrame()
            playblastPath = mutils.gui.tempPlayblastPath()

            mutils.gui.capture(
                path=playblastPath,
                startFrame=startFrame,
                endFrame=endFrame,
                step=step,
                clearCache=True,
                captured=self._captured,
            )

        except Exception, msg:
            title = "Error while taking snapshot"
            QtWidgets.QMessageBox.critical(None, title, str(msg))
            raise
Beispiel #2
0
    def thumbnailCapture(self):
        """
        :raise: AnimItemError
        """
        startFrame, endFrame = mutils.selectedFrameRange()
        if startFrame == endFrame:
            self.validateFrameRange()
            endFrame = self.endFrame()
            startFrame = self.startFrame()

        # Ignore the by frame dialog when the control modifier is pressed.
        if not studioqt.isControlModifier():
            self.showByFrameDialog()

        try:
            step = self.byFrame()
            playblastPath = mutils.gui.tempPlayblastPath()

            mutils.gui.thumbnailCapture(
                path=playblastPath,
                startFrame=startFrame,
                endFrame=endFrame,
                step=step,
                clearCache=True,
                captured=self._thumbnailCaptured,
            )

        except Exception as e:
            title = "Error while capturing thumbnail"
            QtWidgets.QMessageBox.critical(self.libraryWidget(), title, str(e))
            raise
Beispiel #3
0
    def snapshot(self):
        """
        :raise: AnimationPluginError
        """
        startFrame, endFrame = mutils.selectedFrameRange()
        if startFrame == endFrame:
            self.validateFrameRange()
            endFrame = self.endFrame()
            startFrame = self.startFrame()

        self.showByFrameDialog()

        try:
            step = self.byFrame()
            playblastPath = mutils.gui.tempPlayblastPath()

            mutils.gui.capture(
                path=playblastPath,
                startFrame=startFrame,
                endFrame=endFrame,
                step=step,
                clearCache=True,
                captured=self._captured,
            )

        except Exception, msg:
            title = "Error while taking snapshot"
            QtWidgets.QMessageBox.critical(None, title, str(msg))
            raise
    def __init__(self, parent=None):
        super(FrameRangeMenu, self).__init__(parent)

        action = FrameRangeAction("From Timeline", self)
        action.setFrameRange(mutils.playbackFrameRange())
        self.addAction(action)

        action = FrameRangeAction("From Selected Timeline", self)
        action.setFrameRange(mutils.selectedFrameRange())
        self.addAction(action)

        action = FrameRangeAction("From Selected Objects", self)
        action.setFrameRange(mutils.selectedObjectsFrameRange())
        self.addAction(action)
 def setStartFrame(self):
     """
     :rtype: None
     """
     start, end = mutils.selectedFrameRange()
     self.ui.startFrameEdit.setText(str(start))
Beispiel #6
0
 def setStartFrame(self):
     """
     :rtype: None
     """
     start, end = mutils.selectedFrameRange()
     self.ui.startFrameEdit.setText(str(start))
Beispiel #7
0
    def load(
        self,
        objects=None,
        namespaces=None,
        option=None,
        keysOption=None,
        time=None,
    ):
        """
        Load the mirror table for the given objects.

        :type objects: list[str]
        :type namespaces: list[str]
        :type option: mirrorOptions
        :type keysOption: None or KeysOption.SelectedRange
        :type time: None or list[int]
        """
        if option and not isinstance(option, int):
            if option.lower() == "swap":
                option = 0
            elif option.lower() == "left to right":
                option = 1
            elif option.lower() == "right to left":
                option = 2
            else:
                raise ValueError('Invalid load option=' + str(option))

        self.validate(namespaces=namespaces)

        results = {}
        animation = True
        foundObject = False
        srcObjects = self.objects().keys()

        if option is None:
            option = MirrorOption.Swap

        if keysOption == KeysOption.All:
            time = None
        elif keysOption == KeysOption.SelectedRange:
            time = mutils.selectedFrameRange()

        # Check to make sure that the given time is not a single frame
        if time and time[0] == time[1]:
            time = None
            animation = False

        matches = mutils.matchNames(
            srcObjects=srcObjects,
            dstObjects=objects,
            dstNamespaces=namespaces,
        )

        for srcNode, dstNode in matches:
            dstObj = dstNode.name()
            dstObj2 = self.mirrorObject(dstObj) or dstObj

            if dstObj2 not in results:
                results[dstObj] = dstObj2

                mirrorAxis = self.mirrorAxis(srcNode.name())
                dstObjExists = maya.cmds.objExists(dstObj)
                dstObj2Exists = maya.cmds.objExists(dstObj2)

                if dstObjExists and dstObj2Exists:
                    foundObject = True
                    if animation:
                        self.transferAnimation(dstObj,
                                               dstObj2,
                                               mirrorAxis=mirrorAxis,
                                               option=option,
                                               time=time)
                    else:
                        self.transferStatic(dstObj,
                                            dstObj2,
                                            mirrorAxis=mirrorAxis,
                                            option=option)
                else:
                    if not dstObjExists:
                        msg = "Cannot find destination object {0}"
                        msg = msg.format(dstObj)
                        logger.debug(msg)

                    if not dstObj2Exists:
                        msg = "Cannot find mirrored destination object {0}"
                        msg = msg.format(dstObj2)
                        logger.debug(msg)

        # Return the focus to the Maya window
        maya.cmds.setFocus("MayaWindow")

        if not foundObject:

            text = "No objects match when loading data. " \
                   "Turn on debug mode to see more details."

            raise mutils.NoMatchFoundError(text)