Exemple #1
0
def rollback_hda():
    filepath = rollback_window.result
    if filepath is not None:
        environment = Environment()
        hou.hda.uninstallFile(src, change_oplibraries_file=False)
        dst = os.path.join(environment.get_hda_dir(), asset_name)
        hou.hda.installFile(dst)
        message_gui.info('Rollback successful')
	#now that we have gotten past all the things that could go wrong we will make a quick grouping to the selection that we don't want the user to know about.
	try:
		pm.group(name=name)
	except:
		millis = byuutil.timestampThisYear()
		name = name + str(millis)
		pm.group(name=name)

	#get the file name for our new asset
	cycleFile = pm.exportSelected(cacheFileName, preserveReferences=True, force=True)
	pm.saveFile() #Make sure we save it so that we will have that group again when we open it.
	print 'opening', cycleFile
	pm.openFile(cycleFile, force=True)

	result = message_gui.info("Please take a look at the cycle. Make sure everything is in order. \nMake sure you have all the models that you selected. \nMake sure there aren't any extra references that you didn't select.\nIf everything looks okay then publish this cycle, open your file, (located here: " + fileName + "), and then use the red reference button to bring it into the scene.")

	#Set frameRange as specified by the user.
	pm.playbackOptions(ast=firstFrame)
	pm.playbackOptions(aet=lastFrame)
	pm.saveFile()

	user = project.get_current_username()
	comment = 'First crowd cycle publish'

	element.publish(user, cycleFile, comment)

	# Select the group then grab the selection
	selection = pm.select(name)
	selection = pm.ls(selection=True)
Exemple #3
0
def noEducationalLicence():
	pm.FileInfo()['license'] = 'education'
	fileName = pm.sceneName()
	pm.saveFile()
	message_gui.info('This Maya file has been converted to an education licence')
Exemple #4
0
def rollback_shot():
    filepath = rollback_window.result
    if filepath is not None:
        hou.hipFile.load(filepath)
        message_gui.info('Rollback successful')
    def export(self):
        self.close()

        # Get user, project, and time info so we can make a temp folder
        user = self.environment.get_current_username()
        projectName = self.project.get_name().lower()
        time_now = datetime.datetime.now()

        #Make a temp folder for the rib files based on the user and the current time
        ribDir = self.project.get_project_dir(
        ) + '/ribs/' + user + '_' + time_now.strftime('%m%d%y_%H%M%S')
        print 'ribDir', ribDir, ' renderNodes size: ', len(self.renderNodes)
        os.makedirs(ribDir)

        # Sanitize job title
        title = re.sub(r'[{}"\']', '',
                       str(self.jobName.text())).strip(' \t\n\r')
        if len(title) == 0:
            title = self.empty_text

        numCores = int(
            re.sub(r'[{}"\']', '', str(self.numCores.text())).strip(' \t\n\r'))
        if numCores < 1:
            numCores = 1

        # This job we send to tractor
        job = author.Job()
        job.title = title
        job.priority = self.priority.currentIndex()
        path = '/opt/pixar/RenderManProServer-21.5/bin/'
        job.envkey = [
            'setenv PATH=' + path +
            ' RMANTREE=/opt/pixar/RenderManProServer-21.5'
        ]
        job.service = 'PixarRender'
        job.comment = 'Spooled by ' + user

        # Loop through each frame of our nodes and create frame tasks and append it to the job script
        for index, node in enumerate(self.renderNodes):
            # Make sure this node was selected for export
            print node.name()
            if self.select.item(index).isSelected():
                name = node.name()
                validFrameRange = node.parm('trange').eval()
                if validFrameRange == 0:
                    start = int(hou.frame())
                    end = int(hou.frame())
                    step = 1
                else:
                    start = int(node.parm('f1').eval())
                    end = int(node.parm('f2').eval())
                    step = int(node.parm('f3').eval())
                task = author.Task()
                task.title = '%s [%d-%d]' % (name, start, end)

                oldOutputMode = node.parm('rib_outputmode').eval()
                try:
                    oldDiskFile = node.parm('soho_diskfile').expression()
                    useExpression = True
                    print 'We are getting rid of expressiion'
                except:
                    oldDiskFile = node.parm('soho_diskfile').eval()
                    useExpression = False
                    print 'we didn\'t get rid of them'
                # Activate rib output
                node.parm('rib_outputmode').set(True)
                node.parm('soho_diskfile').deleteAllKeyframes()
                node.parm('soho_diskfile').set(ribDir +
                                               ('/%s_$F04.rib' % name))

                print 'start rib making'
                script = os.path.join(self.project.get_project_dir(),
                                      'byu-pipeline-tools', 'houdini-tools',
                                      'parallelRibs', 'taskDistribution.sh')
                subprocess.call([
                    'sh', script,
                    str(start),
                    str(end),
                    str(node.path()),
                    str(saveHipRenderCopy()),
                    str(numCores)
                ])
                print 'finish rib making'

                # Loop through every frame in framerange
                for frame in range(start, end + 1, step):
                    subtask = author.Task()
                    subtask.title = 'Frame %04d' % (frame)
                    ribFile = '%s/%s_%04d.rib' % (ribDir, name, frame)
                    print 'Here is the rib file ', ribFile

                    # Commands for Debugging
                    cmdPATH = author.Command()
                    cmdPATH.argv = ['echo', '${PATH}']
                    cmdRMANTREE = author.Command()
                    cmdRMANTREE.argv = ['echo', '${RMANTREE}']
                    printenv = author.Command()
                    printenv.argv = ['printenv']
                    # subtask.addCommand(cmdPATH)
                    # subtask.addCommand(cmdRMANTREE)
                    # subtask.addCommand(printenv)

                    # Real Commands
                    command = author.Command()
                    command.argv = ['prman', '-progress', ribFile]
                    command.service = 'PixarRender'
                    subtask.addCommand(command)
                    task.addChild(subtask)
                job.addChild(task)

                # Restore rib output
                node.parm('soho_outputmode').set(oldOutputMode)
                if useExpression:
                    node.parm('soho_diskfile').setExpression(oldDiskFile)
                else:
                    node.parm('soho_diskfile').set(oldDiskFile)

        command = author.Command()
        command.argv = ['rm', '-rf', ribDir]
        job.addCleanup(command)

        # print 'This is the new job script \n', job.asTcl()

        # Attempt to spool job, with the option to keep trying
        choice = True
        while choice:
            try:
                job.spool()
                message_gui.info('Job sent to Tractor!')
                break
            except Exception as err:
                choice = message_gui.yes_or_no(
                    'We ran into this problem while spooling the job:\nWould you like to try again?',
                    details=str(err),
                    title='Continue?')
        #Cleanup ifd files, if they didn't want to retry
        if not choice:
            shutil.rmtree(ribDir)