コード例 #1
0
ファイル: toPDFShots.py プロジェクト: briceFoundry/flixOps
    def execute(self, shotCutList, selection, additionalData=None):
        markerList = MarkerList.fromShotCutList(shotCutList)
        markerShotLists = MarkerList.markerShotCutList(shotCutList, markerList)
        for markerShot in markerShotLists:
            self.shotCutList = markerShot
            self.addProgress(len(self.shotCutList)+8)
            self.mode = self.shotCutList.mode
            pdf = self.getPDFTemplate()

            pdf.buildCanvas()
            self.removeProgress(1)
            if pdf._dialogueErrors:
                failedDialogues = ", ".join([shot.recipe.getLabelName() for shot in pdf._dialogueErrors])
                self._execMessage = "Executed %s Plugin Successfully\n\nFailed to parse dialogue for the following clips:\n%s"%(self.label, failedDialogues)
コード例 #2
0
    def getShotsInfo(self):
        markerList = MarkerList.fromShotCutList(self.shotCutList)
        shotLabels = []
        for marker in markerList:
            shotLabels.append(marker.name)
        markerShotLists = MarkerList.markerShotCutList(self.shotCutList,
                                                       markerList)
        if not markerShotLists:
            markerShotLists.append(self.shotCutList)

        shots = []
        firstFrame = 1
        lastFrame = 0
        sequencePanelIndex = 0
        for markerShot in markerShotLists:
            if markerShot.isMarker:
                dialogue = ''
                shotInfo = OrderedDict()
                shotLabel = shotLabels[markerShotLists.index(markerShot)]
                shotInfo['shot label'] = shotLabel
                for shot in markerShot:
                    sequencePanelIndex += 1
                    duration = self.shotCutList[sequencePanelIndex].duration
                    lastFrame += int(round(duration))
                    if shot is markerShot[-1]:
                        dissolveOut = int(round(shot.dissolveOut))
                    if shot is markerShot[0]:
                        dissolveIn = int(round(shot.dissolveIn))
                    newDialogue = shot.recipe.getPoses()[0]['dialogue']
                    if newDialogue != '':
                        dialogue = '\n'.join([dialogue, newDialogue])
                workingDuration = (lastFrame + dissolveOut - firstFrame) + 1
                cutDuration = workingDuration - dissolveIn - dissolveOut
                shotInfo['first frame'] = firstFrame
                shotInfo['last frame'] = lastFrame + dissolveOut
                shotInfo['cut duration'] = cutDuration
                shotInfo['dissolve in'] = dissolveIn
                shotInfo['dissolve out'] = dissolveOut
                shotInfo['working duration'] = workingDuration
                shotInfo['dialogue'] = dialogue
                shots.append(shotInfo)
                firstFrame = lastFrame + 1 - dissolveOut
                sequencePanelIndex += 1
        return shots
コード例 #3
0
    def getShotsInfo(self):
        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)

        # List of shot info of the form [[shotLabel, firstFrame, lastFrame, dissolveIn, dissolveOut]]
        newShots = []
        firstFrame = 0
        lastFrame = 0
        dialogue = ""
        sequencePanelIndex = 0
        for markerShot in markerShotLists:
            if markerShot.isMarker:
                shotLabel = shotLabels[markerShotLists.index(markerShot)]
                for shot in markerShot:
                    sequencePanelIndex += 1
                    duration = self.shotList[sequencePanelIndex].duration
                    lastFrame += int(round(duration))
                    if shot is markerShot[-1]:
                        dissolveOut = int(round(shot.dissolveOut))
                    if shot is markerShot[0]:
                        dissolveIn = int(round(shot.dissolveIn))
                    newDialogue = str(shot.recipe.getPoses()[0]['dialogue'])
                    if newDialogue != "":
                        dialogue = "\n".join([dialogue, newDialogue])
                newShots.append([
                    shotLabel, firstFrame, lastFrame - 1 + dissolveOut,
                    dissolveIn, dissolveOut, dialogue
                ])
                firstFrame = lastFrame - dissolveOut
                sequencePanelIndex += 1
        log("newShots: %s" % newShots)
        return newShots
コード例 #4
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)
コード例 #5
0
ファイル: toShotgunGEAH.py プロジェクト: briceFoundry/flixOps
    def autoMarkOmittedShots(self):
        """
        Go through all the shots in shotgun and set the Omit status if a shot is not part of the edit
        :return:
        """
        shotNames = []
        markerIndex = 1
        for shot in self.shotList:
            if shot.isMarker():
                markerIndex, markerName = MarkerList.getMarkerName(
                    shot, markerIndex)
                shotNames.append(markerName)

        if len(shotNames) == 0:
            flix.logger.log('No shots were found in the edit')
            return

        pFilters = [['sg_sequence', 'is', self.sgSeq]]
        pFields = ['id', 'code', 'sg_status_list']
        allShots = self.sg.find('Shot', pFilters, pFields)
        for shot in allShots:
            if shot['code'] not in shotNames:
                self.sg.update('Shot', shot['id'], {'sg_status_list': 'omt'})
コード例 #6
0
ファイル: burnInPerShot.py プロジェクト: briceFoundry/flixOps
    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)
コード例 #7
0
    def execute(self, shotCutList, selection, additionalData=None):
        if not additionalData is None:
            referenceCutList = additionalData.get('reference', None)
            comment = additionalData.get('comment', "")
        else:
            comment = ''

        flix.logger.log(comment)
        ## ToDo - Do we even need this comment stuff? It never gets used.
        # 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)

        ## ToDo - Move this stuff to it's own function
        ## It may be possible to just delete this - it also gets set when
        ## calling getPrerenderedStatus(), which is also when it gets used.
        self.sg = self._connectToSG(self.mode)
        self.removeProgress()

        self.seqUrl = self.getSequenceUrl()

        ## Question for Foundry - These lines are effectively duplicated in
        ## getPrerenderedStatus(). Should only one or the other be used?
        ## Should they be declared in __init__ and have this and the calls
        ## in getPrerenderedStatus() moved to a setter instead?
        # validate that all information for Flix has an equivalent in shotgun
        #self.sgShow = self._validateShow(self.shotList.show)
        #self.sgSeq = self._validateSeqs(self.shotList.sequence)

        self.removeProgress()

        ## Let it be known that getMarkerList() does not return a MarkerList.
        ## It instead returns a list of ShotCutLists.
        ## Because I don't know.
        shotCutLists = self.getMarkerList(self.shotList)
        self.removeProgress()

        ## ToDo - If shotCustLists is None, bad things happen
        ## shotCutLists should never be None - if getMarkerList fails to create
        ## a ShotCutList, it returns an empty list.
        ## I don't think the empty list can break this function, but it does
        ## have disturbing implications for uses elsewhere.
        if not shotCutLists:
            shotCutLists.append(self.shotList)

        ## This is bad. I'm just hoping that markerList is the same length and
        ## matches self.shotList index-for-index. Ideally this would be handled
        ## inside toMov() so that the shot and marker are definitely matched.
        ## Calling fromShotCutList on the ShotCutList that gets passed returns
        ## an empty list, however.
        markerList = MarkerList.fromShotCutList(self.shotList)

        self.addProgress(len(shotCutLists))
        self.markIn = 1
        self.markOut = 0

        ## In the original Flix code this is adapted from, scl and shotCutLists
        ## were named 'markerShot' and 'markerShotLists'. Those names were lies
        ## and have been changed here to reflect the actual object types.
        for i, scl in enumerate(shotCutLists):
            ## Question for Foundry - When is a ShotCutList not a Marker?
            ## What does it mean for a ShotCutList to be a Marker?
            ## All tests so far have never entered the else clause of the
            ## following statement. Is that expected?
            if scl.isMarker:
                for shot in scl:
                    self.markOut += int(round(shot.duration))

                ## ToDo - Uncomment this once we're willing to check things
                ## against Shotgun again
                #self.sgShot = self._validateShot(scl)
                #self._validateVersion(scl)

                flix.logger.log('CALLING NUKETESTEA.CREATEMOV')
                movie = self.createMov(scl, markerList[i])
                ## The += was taken from regular Flix code, but I think it's
                ## a bug, since it very quickly results in markIn being
                ## thousands of frames ahead of markOut.
                # self.markIn += self.markOut
                self.markIn = self.markOut

                ## ToDo - Uncomment this once we're willing to
                ## check against/upload to Shotgun again
                #if not self.sgShot:
                #    self.sgShot = self.createSgShot(scl)
                #sgVersion = self.uploadSeqVersion(movie, self.sgShot, comment=comment)
            else:
                pass  # ToDo - Debug. Remove later.

                #self._validateVersion(scl)
                #self.sgTask = self._validateTask()
                #movie = self.createMov(scl)
                #sgVersion = self.uploadSeqVersion(movie, self.sgSeq,
                #                                  self.sgTask, comment=comment)

            ## Why does this time out after compositing the first sequence?
            ## Why does it composite the first sequence multiple times?

            ## ToDo - Uncomment this stuff once we're compositing
#            self.playlist = self._validatePlaylist()

#            self.updatePlaylist(self.playlist, sgVersion)
            self.removeProgress()

        ## ToDo - Uncomment this once we're composing and willing to upload
        ## to Shotgun
#        ToShotgun.toFile(self, **self.kargs)
#
#        autoMarkOmittedShots = self.mode['[sgAutoMarkOmittedShots]'] == "1"
#
#        if autoMarkOmittedShots:
#            self.autoMarkOmittedShots()

        self.removeProgress()
コード例 #8
0
 def getMarkerList(self, shotList, hiddenMarker=False):
     """Get a list of markers from the current edit
     """
     markerList = MarkerList.fromShotCutList(shotList)
     markerShotLists = MarkerList.markerShotCutList(shotList, markerList)
     return markerShotLists