Esempio n. 1
0
def collectFrameData(address):
    frames_address  = address.replace('Movie(','Frames(')
    try:
        tank_frames = tank.find(frames_address)
    except:
        tank_frames = None
        core.warn( 'Could not find tank address: %s...' % address )
    
    imageSource = ''
    sourceStart = 0
    sourceEnd   = 0
    stereo_pair = []
    
    if ( tank_frames ):
        filepath                    = tank_frames.system.filesystem_location
        
        # extract the stereo pair information from the tank frames object
        stereo_pair                 = tank_frames.properties['stereo_pair']
        if ( not stereo_pair ):
            stereo_pair = ['left']
            
        spath, sname, smin, smax    = get_frame_sequence_source(filepath)
        
        if ( not (spath and sname) ):
            core.warn( 'Could not extract frame data from %s' % filepath )
        else:
            imageSource = os.path.join(spath,sname)
            sourceStart = smin
            sourceEnd   = smax
    
    return (imageSource,sourceStart,sourceEnd,stereo_pair)
    def handleEditSourcePrompt(self):
        '''
        When the current source is edited
        '''

        from __init__ import SUPPORTED_IMAGE, SUPPORTED_MOVIE
        image_list = " ".join( ["*.%s" % ext for ext in SUPPORTED_IMAGE] )
        movie_list = " ".join( ["*.%s" % ext for ext in SUPPORTED_MOVIE] )

        filter = "image sequence file (%(image_list)s);; movie (%(movie_list)s);;all files (*.*)" % vars()

        fileName = self.promptEditSource(
                                         default = self.txtEditSourcePath.text(),
                                         title="Import Source Sequence - select a frame from sequence",
                                         filter=filter,
                                         flgMultiSelection=False
                                         )

        if fileName!=None:
            fileName = str(fileName)
            result = get_frame_sequence_source(fileName)
            if result!=None:
                filePath, fileName, frameMin, frameMax = result

                shotHash = {}
                shotHash["Source Path"] = filePath
                shotHash["Source Name"] = fileName
                shotHash["Start"]       = int(self.spnStart.value())
                shotHash["End"]         = int(self.spnEnd.value())
                shotHash["Max"]         = frameMax
                shotHash["Min"]         = frameMin

                self.tableView.setShotData(shotHash, self.tableView.getSelectedRow()[0])
                self.syncSelectionToSourceEditPanel()
Esempio n. 3
0
    def addShot(self, shotDataHash, index=None, childIndex=None, flgAutoExpand=True):
        '''
        Add a brand new source to mix master.
        The index are for the rows
        '''
        if index==None:
            index = self.model().rowCount()

        if not shotDataHash.has_key('Min'):
            not_used, not_used, shotDataHash['Min'], shotDataHash['Max'] = get_frame_sequence_source(
                                                os.path.join(shotDataHash['Source Path'],shotDataHash['Source Name']))

        self.insertEmptyRow(index, childIndex, flgAutoExpand)

        # now set the data to the row
        self.setShotData(shotDataHash, index, childIndex=childIndex )
Esempio n. 4
0
    def addShot(self,
                shotDataHash,
                index=None,
                childIndex=None,
                flgAutoExpand=True):
        '''
        Add a brand new source to mix master.
        The index are for the rows
        '''
        if index == None:
            index = self.model().rowCount()

        if not shotDataHash.has_key('Min'):
            not_used, not_used, shotDataHash['Min'], shotDataHash[
                'Max'] = get_frame_sequence_source(
                    os.path.join(shotDataHash['Source Path'],
                                 shotDataHash['Source Name']))

        self.insertEmptyRow(index, childIndex, flgAutoExpand)

        # now set the data to the row
        self.setShotData(shotDataHash, index, childIndex=childIndex)
    def _handleAddSourceHelper(self, originalRowSelection, indexRow, overrideData={}):
        """
        add the source
        """

        self.tableView.insertEmptyRow(indexRow)

        self.tableView.clearSelection()
        self.tableView.selectRow(indexRow)

        self.handleShotSelectionChanged()

        from __init__ import SUPPORTED_IMAGE, SUPPORTED_MOVIE
        image_list = " ".join( ["*.%s" % ext for ext in SUPPORTED_IMAGE] )
        movie_list = " ".join( ["*.%s" % ext for ext in SUPPORTED_MOVIE] )

        filter = "image sequence file (%(image_list)s);; movie (%(movie_list)s);;all files (*.*)" % vars()

        fileNameList = self.promptEditSource(
                                         default=self.txtEditSourcePath.text(),
                                         title="Import Source Sequence - select frame source or movie",
                                         filter=filter,
                                         flgMultiSelection=True
                                         )

        if len(fileNameList)==0: # user cancel import
            self.removeSource() # remove the new empty item

            self.tableView.selectRows(originalRowSelection)
            self.handleShotSelectionChanged()

        else:
            newIndex = indexRow
            fileNameList = [str(item) for item in fileNameList]

            filePathAlreadyAdded = [] # in case the user pick more than one frame from the same source

            for fileName in fileNameList:
                result = get_frame_sequence_source(fileName)

                if result!=None:
                    filePath, fileName, frameMin, frameMax = result
                    fullTemplatePath = (filePath, fileName)

                    if fullTemplatePath in filePathAlreadyAdded:
                        continue
                    else:
                        filePathAlreadyAdded.append(fullTemplatePath)

                    if newIndex!=indexRow:
                        self.tableView.insertEmptyRow(newIndex)

                    # get padding info
                    pad = int ( self.lblDefaultPad.text() )
                    if (int(frameMax) - int(frameMin)) < pad*2:
                        pad=0

                    shotHash = {}
                    shotHash["Source Path"] = filePath
                    shotHash["Source Name"] = fileName
                    shotHash["Start"]       = int(frameMin) + pad
                    shotHash["End"]         = int(frameMax) - pad
                    shotHash["Duration"]    = shotHash["End"] - shotHash["Start"]
                    shotHash["Max"]         = frameMax
                    shotHash["Min"]         = frameMin
                    shotHash["Head"]        = 0
                    shotHash["Tail"]        = 0
                    shotHash["L - Source"]  = "*"

                    # set any override data, this is use when the parent want to pass on some data to children
                    for k in overrideData.keys():
                        shotHash[k] = overrideData[k]

                    self.tableView.setShotData(shotHash, newIndex)

                    # increment the index
                    if type(newIndex)==int:
                        newIndex +=1
                    elif newIndex[1]==None:
                        newIndex = (newIndex[0]+1, None)
                    else:
                        newIndex = (newIndex[0], newIndex[1]+1)