def press_btnAccept(self): if not os.path.exists(self.load_file): self.set_status('FAILED LOADING : Path doesnt exists: {}'.format(self.load_file), msg_type=3) return False open_software = self.software_format[os.path.splitext(self.load_file)[1][1:]].upper() # OPEN in current software try: if open_software.lower() == Tank().software.software.lower(): Tank().software.scene_open(self.load_file) self.wgHeader.close() elif open_software in self.data['software'].keys(): try: Tank().software.start(open_software, self.load_file) except: LOG.error('FAILED to open software', exc_info=True) else: subprocess.Popen(self.load_file, shell=True) except: LOG.warning("No Software setup") note = arNotice.Notice(title = os.path.basename(self.load_file).split('.')[0], msg = self.wgPreview.edtComment.toPlainText(), user = self.wgPreview.lblUser.text(), func = 'LOAD', img = self.preview_img_path if os.path.exists(self.preview_img_path) else 'lbl/lbl{}131'.format(Tank().software.software.lower().title()), img_link = os.path.dirname(self.load_file)) arNotice.ArNotice(note)
def render(): this_node = nuke.thisNode() frameStart = int(this_node["frameStart"].getValue()) frameEnd = int(this_node["frameEnd"].getValue()) LOG.info('{}-{}'.format(frameStart, frameEnd)) notice_status = { 'RENDERTHREADS': 'multi process rendering is started', 'RR SUBMIT': 'scene was submit to RR', 'LOCAL': 'local rendering was started', 'NO JOB': 'process seems to be broken' } tmp_job = 'NO JOB' # RENDERTHREADS if this_node["submit"].getValue() == 0.0: from plugins.vuRenderThreads.plugin_nuke import plugin_nuke threads = int(this_node["threads"].getValue()) plugin_nuke.createThreads(frameStart, frameEnd, threads, [this_node.name()]) LOG.info("END : RENDERTHREADS : " + this_node["exrPath"].getValue()) tmp_job = 'RENDERTHREADS' # RENDERFARM elif this_node["submit"].getValue() == 1.0: import rrenderSubmit nuke.load('rrenderSubmit') rrenderSubmit.rrSubmit_Nuke_Node(this_node, frameStart, frameEnd) LOG.info("END : RRSUBMIT : " + this_node["exrPath"].getValue()) tmp_job = 'RR SUBMIT' # LOCAL else: try: nuke.execute(nuke.thisNode(), start=frameStart, end=frameEnd, incr=1) tmp_job = 'LOCAL' except: LOG.error("END : LOCAL : " + this_node["exrPath"].getValue(), exc_info=True) note = arNotice.Notice( title=os.path.basename(nuke.root().name()).split('.')[0], msg=notice_status[tmp_job], func=tmp_job, img='lbl/lblNuke131' if tmp_job != 'NO JOB' else 'lbl/lblWarning131', img_link='') arNotice.ArNotice(note)
def save_file_path(self): # USE ADDITIONAL PUBLISH SCRIPTS if self.wgHeader.cbxAdd.isChecked(): self.update_version() try: Tank().software.scene_saveAs(self.save_file) self.set_meta_data() LOG.info("SAVE : " + self.save_file) except: LOG.error("FAIL : Couldnt save file : {}".format(self.save_file), exc_info=True) return False if self.wgHeader.cbxAdd.isChecked(): # COPY FILE WITH _PUBLISH tmpCopyWork = self.save_file.replace('.', '_{}.'.format(self.data['rules']['STATUS']['publish'])) libSnapshot.save_snapshot(tmpCopyWork) self.set_meta_data(tmpCopyWork) found_version = re.search(self.data['rules']['FILE']['version'], os.path.basename(self.save_file)) if found_version: old_version = re.search(r'\d+', found_version.group()).group() self.save_publish_file = self.save_file.split(found_version.group())[0] + '.' + Tank().software.extension if self.data['rules']['STATUS']['work'] in self.save_file: self.save_publish_file = self.save_publish_file.replace(self.data['rules']['STATUS']['work'], self.data['rules']['STATUS']['publish']) else: LOG.error("FAIL : NO {} in path : {}".format(self.data['rules']['STATUS']['work'], self.save_publish_file), exc_info=True) return False libFunc.create_folder(os.path.dirname(self.save_publish_file)) try: shutil.copy(self.save_file, tmpCopyWork) shutil.copy(tmpCopyWork, self.save_publish_file) except: LOG.error("FAIL : Copying publish file : {}".format(self.save_publish_file), exc_info=True) return False LOG.info("PUBLISH : " + self.save_publish_file) libSnapshot.save_snapshot(self.save_publish_file) self.set_meta_data(self.save_publish_file) note = arNotice.Notice(title = os.path.basename(self.save_file).split('.')[0], msg = self.wgSave.edtComment.text(), func = 'SAVE' if not self.wgHeader.cbxAdd.isChecked() else 'PUBLISH', img = libSnapshot.default_tmp_path, img_link = os.path.dirname(self.save_file)) arNotice.ArNotice(note) libSnapshot.save_snapshot(self.save_file) return True
def get_help(name=''): project_data = libData.get_data('project')['HELP'] if not name: name = os.getenv('SOFTWARE').lower() note = arNotice.Notice(title=name, msg='get help & solve issues here', func='HELP', img='lbl/lbl{}131'.format(name.title()), img_link='') arNotice.ArNotice(note) if name in project_data: webbrowser.open(project_data[name]) else: webbrowser.open(project_data['main'])
def create_folder_structure(self): # CHECK inputs for inputs in self.inputs: if not inputs.currentText(): if self.scene_steps < 5 and self.wgSaveAs.cbxSet == inputs: continue self.set_status('Missing input: {}'.format( inputs.objectName().replace('cbx', '')), msg_type=2) return False self.update_file() # CHECK FILE if os.path.exists(self.save_file): self.set_status('PATH already exists: {}'.format(self.save_file), msg_type=2) return False save_list = [] if self.all_task in self.save_file: for task in Tank().data_project['TASK'][ self.wgSaveAs.cbxScene.currentText()]: new_path = self.save_file.replace(self.all_task, task) save_list.append(new_path) else: save_list.append(self.save_file) LOG.debug('Folder list {}'.format(save_list)) for folder in save_list: pipefunc.create_folder(folder) if self.new_file: Tank().software.scene_save_as(self.save_file, setup_scene=True) snapshot.create_any_screenshot(self.wgSaveAs) tmp_img_path = snapshot.save_snapshot(self.save_file) tmp_title = os.path.basename(self.save_file).split('.')[0] tmp_func = 'SAVE AS' self.set_meta_data(self.save_file) else: try: self.set_open_folder(save_list[0]) except: LOG.error('CANT set folder: {}'.format(save_list)) self.set_status('Created new {}'.format( self.wgSaveAs.cbxScene.currentText()), msg_type=1) tmp_img_path = 'lbl/lbl_create' tmp_title = self.wgSaveAs.cbxScene.currentText() tmp_func = 'CREATE' note = arNotice.Notice(title=tmp_title, msg='CREATED a new {} with folders'.format( self.wgSaveAs.cbxScene.currentText()), func=tmp_func, img=tmp_img_path, img_link=os.path.dirname(self.save_file)) arNotice.ArNotice(note) return True