def set_path(self, sd=workspace.getPath()): """ Shows a folder browser and assigns the selection to the location text box. """ path = fileDialog2(dialogStyle=1, fileMode=2, startingDirectory=sd, caption='Select your output directory') if path: path = path[0] self.path.setText(path) return path
def job_data(self): return { 'renderer': get_job_type(), 'title': self.job_title, 'project': os.path.normpath(workspace.getPath()), 'output': os.path.join(JOB_OUTPUT_UNC, getpass.getuser(), '{job_id}', 'output'), # job_id is injected by hpc-spool when the submission happens 'scene': os.path.normpath(sceneName()), 'start': self.job_start, 'end': self.job_end, 'threads': self.job_threads, 'step': self.job_step, }
def job_data(self): job_uuid = JobSpec.new_uuid() return { 'renderer': get_job_type(), 'title': self.job_title, 'project': os.path.normpath(workspace.getPath()), 'output': os.path.join(JOB_OUTPUT_UNC, getpass.getuser(), job_uuid), 'scene': os.path.normpath(sceneName()), 'start': self.job_start, 'end': self.job_end, 'threads': self.job_threads, 'step': int(Scene().defaultRenderGlobals.byFrameStep.get()), 'uuid': job_uuid, }
def job_data(self): moddedType = str(get_job_type()) if os.environ['EMULATE'] == '0': moddedType +='_local' return { 'renderer': moddedType, 'title': self.job_title, 'project': os.path.normpath(workspace.getPath()), 'output': os.path.join('D:\\hpc\\', getpass.getuser(), '{job_id}', 'output'), # job_id is injected by hpc-spool when the submission happens 'scene': os.path.normpath(sceneName()), 'start': self.job_start, 'end': self.job_end, 'threads': 4, #self.job_threads, 'step': self.job_step, 'ext' : None }
def on_exportButton_clicked(self): if not ls(selection=True): return error('Nothing is currently selected.') # Load the objExport plug-in if it hasn't been already. kwargs = {} if self.formatExt.text() == '.obj': mll = 'objExport.mll' if not pluginInfo(mll, query=True, loaded=True): try: loadPlugin(mll) info('Loaded plug-in: ' + mll) except: return error('Failed loading plug-in: ' + mll) #kwargs = dict(force=True, constructionHistory=False, # channels=False, constraints=False, expressions=True, # shader=False, preserveReferences=False, type='OBJexport') options = dict(groups=self.groups, ptgroups=self.pointGroups, materials=self.materials, smoothing=self.smoothing, normals=self.normals) options = ';'.join('%s=%d' % (k, cb.isChecked()) \ for k, cb in options.items()) kwargs = dict(exportSelected=True, type='OBJexport', force=True, options=options) elif self.exportCombo.currentIndex() == 2: # mesh return error('Unsupported extension: %s.' % self.formatExt.text()) # Validate the output path. output_path = Path(self.path.text()) if not output_path.exists(): output_path = Path(self.set_path(workspace.getPath())) if not output_path.exists(): return # Validate the frame range. start, end, by = self.start.value(), self.end.value(), self.by.value() remainder = (end - start) % by if remainder: click_result = confirmDialog(title='Confirm', message=os.linesep.join(( \ 'The end frame will not be exported because', 'the "by frame" overshoots it by %.2f.' % remainder)), button=('OK', 'Cancel'), cancelButton='Cancel', defaultButton='OK', dismissString='Cancel') if click_result == 'Cancel': return # Validate the format. format = str(self.format.text()) try: format % (start + by) except TypeError: return error('Invalid format: "%s". ' % format + \ 'Click the \'...\' tool button for help.' % format) # Disable UI elements while running. [o.show() for o in self.run_showers] [o.setEnabled(False) for o in self.run_disablers] # Set the range. if self.renumFrames.isChecked(): renum_start = self.renumStart.value() self.renum_by = self.renumBy.value() else: renum_start = start self.renum_by = by self.frame, self.renum_frame = start, renum_start # Set loop vars. self.aborted = False self.export_count = 0 self.copy_and_replace_all = False # Call the appropriate export function. (self.export_skeleton, self.export_camera, self.export_mesh, self.export_skin_weights)[self.exportCombo.currentIndex()](**kwargs) self.main_progress.endProgress() # Enable UI elements back. [o.hide() for o in self.run_showers] [o.setEnabled(True) for o in self.run_disablers] # Report results. if self.aborted: msg = 'Aborted with %s exported' else: msg = 'Successfully exported %s' plural = self.export_count != 1 and 's' or '' frames = '%d frame' % self.export_count + plural result(msg % frames + ' to: %s.' % output_path)