Exemple #1
0
        def nim_jobChanged(self):
            '''Action when job is selected'''
            #print "JOB CHANGED"
            job = self.nim_jobChooser.currentText()
            self.nim_jobID = self.nim_jobs[job]
            self.nim_jobPaths = nimAPI.get_paths('job', self.nim_jobID)

            #self.nim_updateServer()
            self.nim_updateShow()
Exemple #2
0
    def nim_jobChanged(self):
        '''Action when job is selected'''
        #print "JOB CHANGED"
        job = self.nim_jobChooser.currentText()
        self.nim_jobID = self.nim_jobs[job]
        self.nim_jobPaths = nimAPI.get_paths('job', self.nim_jobID)

        ##set jobID global
        nimHieroConnector.g_nim_jobID = self.nim_jobID

        #print "NIM: jobPaths"
        #print self.nim_jobPaths
        self.nim_updateServer()
        self.nim_updateShow()
Exemple #3
0
        def nim_showChanged(self):
            '''Action when job is selected'''
            #print "SHOW CHANGED"
            showname = self.nim_showChooser.currentText()
            if showname:
                print "NIM: show=%s" % showname

                showID = self.nim_showDict[showname]

                ##set showID
                self.nim_showID = showID

                self.nim_showPaths = nimAPI.get_paths('show', showID)
                if self.nim_showPaths:
                    if len(self.nim_showPaths) > 0:
                        #print "NIM: showPaths=", self.nim_showPaths
                        self.nim_showFolder = self.nim_showPaths['root']
                    else:
                        print "NIM: No Show Paths Found"
                else:
                    print "NIM: No Data Returned"
    def exportTrackItem(self, showID, trackItem):
        '''Add video trackItem as shot in NIM and add NIM tag to trackItem'''
        shotID = False
        trackItem_mediaType = trackItem.mediaType()

        exportTrackItem = False
        if trackItem_mediaType == hiero.core.TrackItem.MediaType.kVideo:
            print "Processing Video TrackItem"
            exportTrackItem = True

        if exportTrackItem:
            #iterate though shots and get trackItem details
            print "NIM: Adding Shot %s" % (trackItem)
            print "     name %s" % trackItem.name()
            '''
			print "     duration %s" % trackItem.duration()
			print "     handleInLength %s" % trackItem.handleInLength()
			print "     handleInTime %s" % trackItem.handleInTime()
			print "     handleOutLength %s" % trackItem.handleOutLength()
			print "     handleOutTime %s" % trackItem.handleOutTime()
			print "     playbackSpeed %s" % trackItem.playbackSpeed()
			print "     timelineIn %s" % trackItem.timelineIn()
			print "     timelineOut %s" % trackItem.timelineOut()
			print "     sourceIn %s" % trackItem.sourceIn()
			print "     sourceOut %s" % trackItem.sourceOut()
			'''

            #Check for NIM tag on sequence and set showID
            sequence = trackItem.parentSequence()
            nim_sequence_tag = self.getNimTag(sequence)
            if nim_sequence_tag != False:
                print "NIM: Updating sequence tag"
                nim_sequence_tag.metadata().setValue("tag.showID", showID)
            else:
                print "NIM: Adding sequence tag"
                nim_sequence_tag = hiero.core.Tag("NIM")
                nim_sequence_tag.metadata().setValue("tag.showID", showID)
                nim_script_path = os.path.dirname(__file__)
                nim_icon_path = os.path.join(nim_script_path, 'NIM.png')
                nim_sequence_tag.setIcon(nim_icon_path)
                sequence.addTag(nim_sequence_tag)

            shotInfo = nimAPI.add_shot(showID=showID,
                                       name=trackItem.name(),
                                       frames=trackItem.duration())
            #print shotInfo
            if shotInfo['success'] == 'true':
                shotID = shotInfo['ID']
                print "		NIM shotID: %s" % shotID

                if 'error' in shotInfo:
                    print "		WARNING: %s" % shotInfo['error']
                ''' IF SHOT IS ONLINE GET PATHS '''
                nim_platesPath = 'PLATES'
                nim_compPath = 'COMP'
                nim_renderPath = 'RENDER'
                nim_shotPaths = nimAPI.get_paths('shot', shotID)
                if nim_shotPaths:
                    if len(nim_shotPaths) > 0:
                        #print "NIM: Shot Paths"
                        #print nim_shotPaths
                        nim_shotPath = nim_shotPaths['root']
                        nim_platesPath = nim_shotPaths['plates']
                        nim_renderPath = nim_shotPaths['renders']
                        nim_compPath = nim_shotPaths['comps']

                print '		Adding NIM Tag to shot %s' % trackItem.name()
                nim_tag = hiero.core.Tag("NIM")
                nim_tag.metadata().setValue("tag.showID", showID)
                nim_tag.metadata().setValue("tag.shotID", shotID)
                nim_tag.metadata().setValue("tag.shotPath", nim_shotPath)
                nim_tag.metadata().setValue("tag.platesPath", nim_platesPath)
                nim_tag.metadata().setValue("tag.renderPath", nim_renderPath)
                nim_tag.metadata().setValue("tag.compPath", nim_compPath)

                nim_script_path = os.path.dirname(__file__)
                nim_icon_path = os.path.join(nim_script_path, 'NIM.png')
                #print '		Icon Path: %s' % nim_icon_path
                #nim_tag.setIcon('./NIM.png')
                nim_tag.setIcon(nim_icon_path)

                tmp_tag = trackItem.addTag(nim_tag)
                #print tmp_tag

            else:
                if shotInfo['error']:
                    #error exists
                    print "		ERROR: %s" % shotInfo['error']
                shotID = False
        else:
            print "NIM: Skipping MediaType"
            print trackItem_mediaType
            shotID = False

        return shotID
    def updateTrackItem(self, showID, trackItem):
        '''Update trackItem linked to shot in NIM'''

        trackItem_mediaType = trackItem.mediaType()

        exportTrackItem = False
        if trackItem_mediaType == hiero.core.TrackItem.MediaType.kVideo:
            print "Processing Video TrackItem"
            exportTrackItem = True

        if exportTrackItem:
            #iterate though shots and get trackItem details
            print "NIM: Adding Shot ", trackItem.name()
            '''
			print "NIM: Adding Shot %s" % (trackItem)
			print "     name %s" % trackItem.name()
			print "     duration %s" % trackItem.duration()
			print "     eventNumber %s" % trackItem.eventNumber()
			print "     handleInLength %s" % trackItem.handleInLength()
			print "     handleInTime %s" % trackItem.handleInTime()
			print "     handleOutLength %s" % trackItem.handleOutLength()
			print "     handleOutTime %s" % trackItem.handleOutTime()
			print "     playbackSpeed %s" % trackItem.playbackSpeed()
			print "     timelineIn %s" % trackItem.timelineIn()
			print "     timelineOut %s" % trackItem.timelineOut()
			print "     sourceIn %s" % trackItem.sourceIn()
			print "     sourceOut %s" % trackItem.sourceOut()
			'''

            #get NIM tag for shot
            nim_tag = self.getNimTag(trackItem)

            if nim_tag != False:
                # UPDATE trackItem details in NIM

                #showID = nim_tag.metadata().value("tag.showID")
                #Check for NIM tag on sequence and set showID
                sequence = trackItem.parentSequence()
                nim_sequence_tag = self.getNimTag(sequence)
                if nim_sequence_tag != False:
                    print "NIM: Updating sequence tag"
                    nim_sequence_tag.metadata().setValue("tag.showID", showID)
                else:
                    print "NIM: Adding sequence tag"
                    nim_sequence_tag = hiero.core.Tag("NIM")
                    nim_sequence_tag.metadata().setValue("tag.showID", showID)
                    nim_script_path = os.path.dirname(__file__)
                    nim_icon_path = os.path.join(nim_script_path, 'NIM.png')
                    nim_sequence_tag.setIcon(nim_icon_path)
                    sequence.addTag(nim_sequence_tag)

                nim_shotID = nim_tag.metadata().value("tag.shotID")
                '''
				trackItem.timelineIn
				trackItem.timelineOut
				trackItem.playbackSpeed
				'''
                shotInfo = nimAPI.update_shot(nim_shotID, trackItem.duration())

                if shotInfo['success']:
                    print "NIM: Updated corresponding shot in NIM"
                    ''' GET UPDATED PATHS '''
                    nim_shotPath = nim_tag.metadata().value("tag.shotPath")
                    nim_platesPath = nim_tag.metadata().value("tag.platesPath")
                    nim_renderPath = nim_tag.metadata().value("tag.renderPath")
                    nim_compPath = nim_tag.metadata().value("tag.compPath")

                    nim_shotPaths = nimAPI.get_paths('shot', nim_shotID)
                    if nim_shotPaths:
                        if len(nim_shotPaths) > 0:
                            print "NIM: Shot Paths"
                            print nim_shotPaths
                            nim_shotPath = nim_shotPaths['root']
                            nim_platesPath = nim_shotPaths['plates']
                            nim_renderPath = nim_shotPaths['renders']
                            nim_compPath = nim_shotPaths['comps']

                            print '		Updating NIM Paths for shot %s' % trackItem.name(
                            )
                            nim_tag.metadata().setValue(
                                "tag.shotPath", nim_shotPath)
                            nim_tag.metadata().setValue(
                                "tag.platesPath", nim_platesPath)
                            nim_tag.metadata().setValue(
                                "tag.renderPath", nim_renderPath)
                            nim_tag.metadata().setValue(
                                "tag.compPath", nim_compPath)
                    return True
                else:
                    print "NIM: Failed to update shot details"
                    return False
            else:
                print 'NIM: Failed to get Nim Tag'
                return False

        else:
            print "NIM: Skipping MediaType"
            print trackItem_mediaType
            return False