示例#1
0
    def save(self, icon=None, objects=None, force=False):
        """
        @raise:
        """
        log.info("Saving: %s" % self.transferPath())
        try:
            tempDir = studiolibrary.TempDir("Transfer", clean=True)

            if objects is None:
                objects = maya.cmds.ls(selection=True) or []

            if not icon:
                icon = tempDir.path() + "/thumbnail.jpg"
                icon = mutils.snapshot(path=icon)

            self.validateSaveOptions(objects=objects, icon=icon)

            transferPath = tempDir.path() + "/" + self.transferBasename()
            t = self.transferClass().createFromObjects(objects)
            t.save(transferPath)

            studiolibrary.Record.save(self,
                                      content=[transferPath],
                                      icon=icon,
                                      force=force)
        except Exception, msg:
            if self.window():
                self.window().setError(str(msg))
            raise
    def snapshot(self):
        """
        @raise AnimationPluginError:
        """
        startFrame, endFrame = mutils.selectedRange()
        if startFrame == endFrame:
            endFrame = self.endFrame()
            startFrame = self.startFrame()

        self.validateFrameRage()

        if self.settings().get("byFrameDialog") and self.duration(
        ) > 100 and self.byFrame() == 1:
            msg = '''To help speed up the playblast you can set the "by frame" to a greater number than 1.
eg: If the "by frame" is set to 2 it will playblast every second frame.
Would you like to show this message again?'''
            result = self.window().questionDialog(msg, "Tip")
            if result == QtGui.QMessageBox.Cancel:
                raise Exception("Playblast cancelled!")
            elif result == QtGui.QMessageBox.No:
                self.settings().set("byFrameDialog", False)

        # path = studiolibrary.tempDir(make=True, clean=True)
        tempDir = studiolibrary.TempDir(clean=True)

        self._thumbnail = tempDir.path() + "/thumbnail.jpg"
        self._sequence = tempDir.path() + "/sequence/thumbnail.jpg"
        try:
            self._sequence = mutils.snapshot(path=self._sequence,
                                             start=startFrame,
                                             end=endFrame,
                                             step=self.byFrame())
        except mutils.SnapshotError, e:
            self.record().window().setError(str(e))
            raise
    def snapshot(self):
        """
        @raise AnimationPluginError:
        """
        startFrame, endFrame = mutils.selectedRange()
        if startFrame == endFrame:
            endFrame = self.endFrame()
            startFrame = self.startFrame()

        self.validateFrameRage()

        if self.settings().get("byFrameDialog") and self.duration() > 100 and self.byFrame() == 1:
            msg = '''To help speed up the playblast you can set the "by frame" to a greater number than 1.
eg: If the "by frame" is set to 2 it will playblast every second frame.
Would you like to show this message again?'''
            result = self.window().questionDialog(msg, "Tip")
            if result == QtGui.QMessageBox.Cancel:
                raise Exception("Playblast cancelled!")
            elif result == QtGui.QMessageBox.No:
                self.settings().set("byFrameDialog", False)

        # path = studiolibrary.tempDir(make=True, clean=True)
        tempDir = studiolibrary.TempDir(clean=True)

        self._thumbnail = tempDir.path() + "/thumbnail.jpg"
        self._sequence = tempDir.path() + "/sequence/thumbnail.jpg"
        try:
            self._sequence = mutils.snapshot(path=self._sequence, start=startFrame, end=endFrame,
                                             step=self.byFrame())
        except mutils.SnapshotError, e:
            self.record().window().setError(str(e))
            raise
    def save(self, icon=None, objects=None, force=False):
        """
        @raise:
        """
        log.info("Saving: %s" % self.transferPath())
        try:
            tempDir = studiolibrary.TempDir("Transfer", clean=True)

            if objects is None:
                objects = maya.cmds.ls(selection=True) or []

            if not icon:
                icon = tempDir.path() + "/thumbnail.jpg"
                icon = mutils.snapshot(path=icon)

            self.validateSaveOptions(objects=objects, icon=icon)

            transferPath = tempDir.path() + "/" + self.transferBasename()
            t = self.transferClass().createFromObjects(objects)
            t.save(transferPath)

            studiolibrary.Record.save(self, content=[transferPath], icon=icon, force=force)
        except Exception, msg:
            if self.window():
                self.window().setError(str(msg))
            raise
示例#5
0
 def snapshot(self):
     tempDir = studiolibrary.TempDir(makedirs=True)
     self._thumbnail = tempDir.path() + "/thumbnail.jpg"
     try:
         self._thumbnail = mutils.snapshot(path=self._thumbnail)
         self.setSnapshot(self._thumbnail)
     except Exception, e:
         if self.record().window():
             self.record().window().setError(str(e))
         raise
 def snapshot(self):
     tempDir = studiolibrary.TempDir(makedirs=True)
     self._thumbnail = tempDir.path() + "/thumbnail.jpg"
     try:
         self._thumbnail = mutils.snapshot(path=self._thumbnail)
         self.setSnapshot(self._thumbnail)
     except Exception, e:
         if self.record().window():
             self.record().window().setError(str(e))
         raise
示例#7
0
    def createTempIconSequence(startFrame=None, endFrame=None, step=1):
        """
        :type startFrame: int
        :type endFrame: int
        :type step: int
        :rtype: str
        """
        path = Plugin.tempIconSequencePath(clean=True)

        sequencePath = mutils.snapshot(
            path=path,
            start=startFrame,
            end=endFrame,
            step=step)

        iconPath = Plugin.tempIconPath()
        shutil.copyfile(sequencePath, iconPath)
        return iconPath, sequencePath
    def createTempIconSequence(startFrame=None, endFrame=None, step=1):
        """
        :type startFrame: int
        :type endFrame: int
        :type step: int
        :rtype: str
        """
        path = Plugin.tempIconSequencePath(clean=True)

        sequencePath = mutils.snapshot(
            path=path,
            start=startFrame,
            end=endFrame,
            step=step,
        )

        iconPath = Plugin.tempIconPath()
        shutil.copyfile(sequencePath, iconPath)
        return iconPath, sequencePath
示例#9
0
    def snapshot(self):
        """
        :raise AnimationPluginError:
        """
        startFrame, endFrame = mutils.selectedRange()
        if startFrame == endFrame:
            endFrame = self.endFrame()
            startFrame = self.startFrame()
        if startFrame is None or endFrame is None:
            msg = 'Please choose a start frame and an end frame.'
            import traceback
            traceback.print_exc()
            QtGui.QMessageBox.critical(self, 'Error', msg)
            raise AnimationPluginError(msg)
        if self.settings().get('byFrameDialog') and self.duration(
        ) > 100 and self.byFrame() == 1:
            msg = 'To help speed up the playblast you can set the "by frame" to a greater number than 1.\neg: If the "by frame" is set to 2 it will playblast every second frame.\nWould you like to show this message again?'
            result = self.window().questionDialog(msg, 'Tip')
            if result == QtGui.QMessageBox.Cancel:
                raise AnimationPluginError('Playblast cancelled!')
            elif result == QtGui.QMessageBox.No:
                self.settings().set('byFrameDialog', False)
        path = studioLibrary.tempDir(make=True, clean=True)
        self._thumbnail = path + '/thumbnail.jpg'
        self._sequence = path + '/sequence/thumbnail.jpg'
        try:
            self._sequence = mutils.snapshot(path=self._sequence,
                                             start=startFrame,
                                             end=self.endFrame(),
                                             step=self.byFrame())
        except mutils.SnapshotError as e:
            self.record().window().setError(str(e))
            raise

        shutil.copyfile(self._sequence, self._thumbnail)
        self.setSnapshot(self._thumbnail)
        self.ui.sequenceWidget.setDirname(os.path.dirname(self._sequence))
示例#10
0
 def createTempIcon():
     """
     :rtype: str
     """
     path = Plugin.tempIconPath()
     return mutils.snapshot(path=path)
 def createTempIcon():
     """
     :rtype: str
     """
     path = Plugin.tempIconPath()
     return mutils.snapshot(path=path)