Beispiel #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 save(self, objects, path=None, iconPath=None, force=False, **kwargs):
        """
        :type path: path
        :type objects: list
        :type iconPath: str
        :raise ValidateError:
        """
        logger.info("Saving: {0}".format(path))

        contents = list()
        tempDir = studiolibrary.TempDir("Transfer", clean=True)

        transferPath = tempDir.path() + "/" + self.transferBasename()
        t = self.transferClass().fromObjects(objects)
        t.save(transferPath, **kwargs)

        if iconPath:
            contents.append(iconPath)

        contents.append(transferPath)
        studiolibrary.Record.save(self,
                                  path=path,
                                  contents=contents,
                                  force=force)

        logger.info("Saved: {0}".format(path))
    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,
             content=None,
             icon=None,
             startFrame=None,
             endFrame=None,
             bakeConnected=False):
        """
        @raise:
        """
        try:
            objects = maya.cmds.ls(selection=True) or []
            self.validateSaveOptions(objects=objects, icon=icon)

            #tmpPath = studiolibrary.tempDir("transfer") + "/transfer.anim"
            tempDir = studiolibrary.TempDir("Transfer")
            tempPath = tempDir.path() + "/transfer.anim"

            t = self.transferClass().createFromObjects(objects)
            t.save(tempPath,
                   time=[startFrame, endFrame],
                   bakeConnected=bakeConnected)
            content.extend(t.paths())

            self.set("start", startFrame)
            self.set("end", endFrame)

            studiolibrary.Record.save(self, content=content, icon=icon)

        except Exception, msg:
            self.window().setError(str(msg))
            raise
Beispiel #5
0
    def save(self, objects, path=None, contents=None, iconPath=None,
             startFrame=None, endFrame=None, bakeConnected=False):
        """
        :type contents: list[str]
        :type iconPath: str
        :type startFrame: int
        :type endFrame: int
        :type bakeConnected: bool
        :rtype: None
        """
        contents = contents or list()

        tempDir = studiolibrary.TempDir("Transfer", clean=True)
        tempPath = tempDir.path() + "/transfer.anim"

        t = self.transferClass().fromObjects(objects)
        t.save(tempPath, time=[startFrame, endFrame], bakeConnected=bakeConnected)

        if iconPath:
            contents.append(iconPath)

        contents.extend(t.paths())

        self.metaFile().set("start", startFrame)
        self.metaFile().set("end", endFrame)
        studiolibrary.Record.save(self, path=path, contents=contents)
Beispiel #6
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
Beispiel #7
0
    def save(self, left, right, icon=None):
        """
        @raise:
        """
        logger.info("Saving: %s" % self.transferPath())
        try:
            objects = maya.cmds.ls(selection=True) or []
            self.validateSaveOptions(objects, icon)

            tempDir = studiolibrary.TempDir("Transfer", makedirs=True)
            tmpPath = os.path.join(tempDir.path(), self.transferBasename())

            t = self.transferClass().createFromObjects(objects,
                                                       left=left,
                                                       right=right)
            t.save(tmpPath)

            studiolibrary.Record.save(self, content=[tmpPath], icon=icon)
        except Exception, msg:
            self.window().setError(str(msg))
            raise
    def save(self, objects, leftSide, rightSide, path=None, iconPath=None):
        """
        :type path: str
        :type objects: list[str]
        :type iconPath: str
        :rtype: None

        """
        logger.info("Saving: %s" % self.transferPath())

        tempDir = studiolibrary.TempDir("Transfer", makedirs=True)
        tempPath = os.path.join(tempDir.path(), self.transferBasename())

        t = self.transferClass().fromObjects(objects,
                                             leftSide=leftSide,
                                             rightSide=rightSide)
        t.save(tempPath)

        studiolibrary.Record.save(self,
                                  path=path,
                                  contents=[tempPath, iconPath])
 def tempIconSequencePath(clean=False):
     """
     :rtype: str
     """
     tempDir = studiolibrary.TempDir("sequence", clean=clean)
     return tempDir.path() + "/thumbnail.jpg"