예제 #1
0
    def execute(self, shotCutList, selection, additionalData=None):
        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
            shotCutList.defaultPath())
        self.mode = self.shotList.mode

        shotNumber = int(self.mode.get(kMarkerNameIncrement))
        data = []
        data.append('<Recipies>')
        for shot in self.shotList:
            if shot.isMarker():
                recipe = shot.recipe
                properties = recipe.getProperties()
                newName = self.mode.get(kMarkerNameRegex) % shotNumber
                poses = recipe.getPoses()
                poseXML = poses[0]['poseXML']
                poseXML.attrib['dialogue'] = newName
                recipe.saveRecipeFiles()
                data.append(
                    '<Setup show="%(show)s" sequence="%(sequence)s" beat="%(beat)s" setup="%(setup)s" version="%(version)s">'
                    % recipe.getProperties())
                data.append(
                    ET.tostring(recipe.getMultiTrackXML()) + "</Setup>")
                shotNumber += int(self.mode.get(kMarkerNameIncrement))
        data.append("</Recipies>")
        dataString = "".join(data)
        log("DATASTRING: %s" % dataString)
        self.serverFlixFunctions.addFeedback('reloadSetupsMultiTracks',
                                             dataString)
예제 #2
0
    def execute(self, shotCutList, selection, additionalData=None):
        setattr(self, 'selection', selection)

        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
            shotCutList.defaultPath())
        self.mode = self.shotList.mode

        # For each selected panel
        for p in self.selection:
            shot = self.shotList[p]
            if shot.isMarker():
                continue
            # Get the path to the layout panel's jpeg (thumbnail)
            layoutPanelJpegPath = self._getPanelFilePath(shot)
            # Find which version is the latest board (i.e. not from Maya)
            latestBoard = self._getLatestStoryVersion(shot)
            if latestBoard is None:
                log("%s has no non-Maya version." % shot)
                continue
            log("latestBoard: %s" % latestBoard)
            # Get the path to the story panel's jpeg (thumbnail)
            latestBoardJpegPath = self._getPanelFilePath(latestBoard)
            # Create nk script using the paths to both jpeg files
            self.renderPip(layoutPanelJpegPath, latestBoardJpegPath,
                           int(self.mode.get('[yResolution]')),
                           int(self.mode.get('[xResolution]')))
            # Refresh the cache and thumbnail in Flix
            self.fileServiceLocal.refreshCache(layoutPanelJpegPath)
            log('__renderCallback:: Reloading image %s' %
                self.rePath.localize(layoutPanelJpegPath))
            self.serverFlixFunctions.addFeedback("reloadImages",
                                                 [layoutPanelJpegPath])
예제 #3
0
    def __init__(self, shotCutList=''):
        self.fileService = flix.fileServices.FileService()
        self.fileServiceLocal = flix.fileServices.fileLocal.FileLocal()
        self.rePath = RepathDefault()
        # self.shotList    = shotCutList
        if shotCutList != '':
            self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
                shotCutList.defaultPath())
            self.kargs = {
                'show': self.shotList.show,
                'sequence': self.shotList.sequence,
                'branch': self.shotList.branch,
                'version': self.shotList.version
            }
            self.mode = self.shotList.mode
            self.movDir = self.mode.get("[editorialMOVFolder]")

        # load the icon
        iconPath = flix.core2.mode.Mode().get(
            '[FLIX_FOLDER]') + '/assets/20px-quicktime.png'
        icon = self.fileService.loadByteArray(iconPath)

        self.init(label='QuickTime per Shot',
                  icon=icon,
                  tooltip='QuickTime per Shot',
                  group='Export',
                  pluginPath='flixConfig.plugins.toMovPerShot.ToMovPerShot')
예제 #4
0
 def execute(self, shotCutList, selection, additionalData=None):
     self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(shotCutList.defaultPath())
     self.show = self.shotList.show
     sequences = flix.core.sequence.Sequence.sequencesToXMLList(flix.core.sequence.Sequence.getSequences(self.show))
     for seq in sequences:
         seqName = seq.attrib["name"]
         latestShotEdit = self.getLatestShotCutList(seqName)
         log("latestShotEdit: %s" % latestShotEdit)
예제 #5
0
    def execute(self, shotCutList, selection, additionalData=None):
        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
            shotCutList.defaultPath())
        self.kargs = {
            'show': self.shotList.show,
            'sequence': self.shotList.sequence,
            'branch': self.shotList.branch,
            'version': self.shotList.version
        }
        self.mode = self.shotList.mode
        self.movDir = self.mode.get("[editorialMOVFolder]")
        movieFileName = self.shotList.refVideoFilename
        if movieFileName is None:
            raise flix.exceptions.FlixException(
                msg="Current version does not have an editorial movie.",
                notify=True)
        else:
            movieFile = "%s/%s" % (self.movDir, movieFileName)
            log("Movie File: %s" % movieFile)

        self.addProgress(5)
        output = OSUtils.runFileBrowser(kBrowseTypeFolderUsingSaveFile,
                                        'Choose a folder', '/', 'toMovPerShot')
        self.removeProgress(5)
        # escape output path
        output = escape(output.decode('utf-8'))
        if not output or not os.path.isdir(output):
            raise flix.exceptions.FlixException(
                error=output, msg='No Valid directory selected.', notify=False)

        shotInfoObject = ShotInfo(self.shotList)
        shots = shotInfoObject.getShotsInfo()
        self.addProgress(len(shots))

        shotMovies = self.toMovPerShot(shots, movieFile)
        for shotMovie in shotMovies:
            self.fileService.copy(shotMovie, output)

        OSUtils().revealFiles([output])
 def execute(self, shotCutList, selection, additionalData=None):
     self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
         shotCutList.defaultPath())
     newDialogue = "whatever"
     data = []
     data.append('<Recipies>')
     for panel in self.shotList:
         recipe = panel.recipe
         if not panel.isMarker():
             poses = recipe.getPoses()
             poseXML = poses[0]['poseXML']
             poseXML.attrib['dialogue'] = newDialogue
             recipe.saveRecipeFiles()
             data.append(
                 '<Setup show="%(show)s" sequence="%(sequence)s" beat="%(beat)s" setup="%(setup)s" version="%(version)s">'
                 % recipe.getProperties())
             data.append(
                 ET.tostring(recipe.getMultiTrackXML()) + "</Setup>")
     data.append("</Recipies>")
     dataString = "".join(data)
     log("DATASTRING: %s" % dataString)
     self.serverFlixFunctions.addFeedback('reloadSetupsMultiTracks',
                                          dataString)
예제 #7
0
    def execute(self, shotCutList, selection, additionalData=None):
        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(shotCutList.defaultPath())
        log("shotList: %s" % self.shotList)
        self.kargs = {'show'    :self.shotList.show,
                 'sequence':self.shotList.sequence,
                 'branch'  :self.shotList.branch,
                 'version' :self.shotList.version}
        self.mode = self.shotList.mode

        markerList = MarkerList.fromShotCutList(self.shotList)
        log("markerList: %s" % markerList)
        for marker in markerList:
            log("marker: %s" % marker)
        markerShotLists = MarkerList.markerShotCutList(self.shotList, markerList)
        log("markerShotLists 1: %s" % markerShotLists)
        if not markerShotLists:
            markerShotLists.append(self.shotList)
            log("markerShotLists was False, new one: %s" % markerShotLists)

        for markerShot in markerShotLists:
            log("markerShot: %s" % markerShot)
            if markerShot.isMarker:
                for shot in markerShot:
                    log("shot: %s" % shot)
예제 #8
0
 def execute(self, shotCutList, selection, additionalData=None):
     dialogueFile = self.loadFileBrowser()
     if not dialogueFile or not os.path.exists(
             dialogueFile) or not dialogueFile[-4:] == ".txt":
         raise flix.exceptions.FlixException("No valid text file selected.")
     self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
         shotCutList.defaultPath())
     panels = self.getPanelSetupList()
     with open(dialogueFile) as f:
         dialogueFileContent = f.readlines()
     panelDialogueLines = self.getPanelDialogueLines(
         panels, dialogueFileContent)
     data = []
     data.append('<Recipies>')
     for panel in self.shotList:
         recipe = panel.recipe
         if not panel.isMarker():
             dialogueLines = panelDialogueLines[recipe.getShortLabelName()]
             if not dialogueLines == [-1]:
                 newDialogue = u""
                 for line in range(dialogueLines[0], dialogueLines[1] + 1):
                     newDialogue += dialogueFileContent[line].strip("\t")
                 poses = recipe.getPoses()
                 poseXML = poses[0]['poseXML']
                 poseXML.attrib['dialogue'] = newDialogue
                 recipe.saveRecipeFiles()
                 data.append(
                     '<Setup show="%(show)s" sequence="%(sequence)s" beat="%(beat)s" setup="%(setup)s" version="%(version)s">'
                     % recipe.getProperties())
                 data.append(
                     ET.tostring(recipe.getMultiTrackXML()) + "</Setup>")
     data.append("</Recipies>")
     dataString = "".join(data)
     log("DATASTRING: %s" % dataString)
     self.serverFlixFunctions.addFeedback('reloadSetupsMultiTracks',
                                          dataString)
예제 #9
0
    def execute(self, shotCutList, selection, additionalData=None):
        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
            shotCutList.defaultPath())
        self.kargs = {
            'show': self.shotList.show,
            'sequence': self.shotList.sequence,
            'branch': self.shotList.branch,
            'version': self.shotList.version
        }
        self.mode = self.shotList.mode
        self.movDir = self.mode.get("[editorialMOVFolder]")
        movieFile = self.rePath.localize(self.__getMovFilePath())
        if movieFile is None:
            raise flix.exceptions.FlixException(
                msg="Current version does not have an editorial movie.",
                notify=True)
        else:
            log("Movie File: %s" % movieFile)

        self.addProgress(5)
        output = OSUtils.runFileBrowser(kBrowseTypeFolderUsingSaveFile,
                                        'Choose a folder', '/',
                                        'burnInPerShot')
        self.removeProgress(5)
        # escape output path
        output = escape(output.decode('utf-8'))
        if not output or not os.path.isdir(output):
            raise flix.exceptions.FlixException(
                error=output, msg='No Valid directory selected.', notify=False)

        # markerShotLists = self.getMarkerList(self.shotList)

        markerList = MarkerList.fromShotCutList(self.shotList)
        self.addProgress(len(markerList))
        shotLabels = []
        for marker in markerList:
            shotLabels.append(marker.name)
        markerShotLists = MarkerList.markerShotCutList(self.shotList,
                                                       markerList)
        if not markerShotLists:
            markerShotLists.append(self.shotList)

        self.markIn = 1
        self.markOut = 0
        markerTuples = []
        for markerShot in markerShotLists:
            if markerShot.isMarker:
                for shot in markerShot:
                    self.markOut += int(round(shot.duration))
                markerTuples.append((self.markIn, self.markOut))
                self.markIn = self.markOut + 1

        self.breakDownMov(movieFile, markerTuples, shotLabels, self.movDir)

        for shot in shotLabels:
            toReplace = str(shotLabels.index(shot)).zfill(3) + ".tmp"
            oldName = self.movDir + "/" + toReplace + ".mov"
            newName = oldName.replace(toReplace,
                                      shot + "_v" + str(self.shotList.version))
            try:
                # self.fileService.rename(oldName, newName)
                self.addBurnIns(oldName, newName)
                self.fileService.copy(newName, output)
                self.fileService.removeFile(oldName)
                self.fileService.removeFile(newName)
            except Exception, e:
                log("Failed to rename, copy or remove the temp mov: %s" % e,
                    isError=True)
            self.removeProgress(1)
예제 #10
0
    def execute(self, shotCutList, selection, additionalData=None):
        if not additionalData is None:
            referenceCutList = additionalData.get('reference', None)
            comment = additionalData.get('comment', "")
        else:
            comment = ''

        comment = unicode(urllib.unquote_plus(comment))
        self.shotList = flix.core2.shotCutList.ShotCutList.fromFile(
            shotCutList.defaultPath())
        self.kargs = {
            'show': self.shotList.show,
            'sequence': self.shotList.sequence,
            'branch': self.shotList.branch,
            'version': self.shotList.version
        }
        self.mode = self.shotList.mode

        self.addProgress(4)

        markerShotLists = self.getMarkerList(self.shotList)

        self.removeProgress()
        self.sg = self._connectToSG(self.mode)
        self.removeProgress()

        self.seqUrl = self.getSequenceUrl()

        # validate that all information for Flix has an equivalent in shotgun
        self.sgShow = self._validateShow(self.shotList.show)
        if int(Mode(self.shotList.show).get('[isEpisodic]')):
            episodeName = self.shotList.sequence.split("_")[0]
            self.sgEp = self._validateEp(episodeName)
            sequenceName = self.shotList.sequence.split("_")[1]
            self.sgSeq = self._validateSeqs(sequenceName)
        else:
            self.sgEp = None
            self.sgSeq = self._validateSeqs(self.shotList.sequence)

        self.removeProgress()

        # check for shots to create movies and upload to shotgun as version
        # if shots don't exists yet create a movie of the entire sequence and upload to shotgun as version

        if not markerShotLists:
            markerShotLists.append(self.shotList)

        self.addProgress(len(markerShotLists))
        self.markIn = 1
        self.markOut = 0
        for markerShot in markerShotLists:
            if markerShot.isMarker:
                for shot in markerShot:
                    self.markOut += int(round(shot.duration))
                self.sgShot = self._validateShot(markerShot)
                self._validateVersion(markerShot)
                tupleMarker = (markerShot, self.getShotsIndex(markerShot))
                movie = self.createMov(tupleMarker)
                self.markIn += self.markOut
                if not self.sgShot:
                    self.sgShot = self.createSgShot(markerShot)
                sgVersion = self.uploadSeqVersion(movie,
                                                  self.sgShot,
                                                  comment=comment)
            else:
                self._validateVersion(markerShot)
                self.sgTask = self._validateTask()
                movie = self.createMov(markerShot)
                sgVersion = self.uploadSeqVersion(movie,
                                                  self.sgSeq,
                                                  self.sgTask,
                                                  comment=comment)

            # Validate that a FLIX playlist exists or else create one
            self.playlist = self._validatePlaylist()

            # update the FLIX playlist to add the new sgVersion
            self.updatePlaylist(self.playlist, sgVersion)
            self.removeProgress()

        ToShotgunCustom.toFile(self, **self.kargs)

        autoMarkOmittedShots = self.mode['[sgAutoMarkOmittedShots]'] == "1"

        if autoMarkOmittedShots:
            self.autoMarkOmittedShots()

        self.removeProgress()