def execute(self): file = utils.temp_file_from_command(self.command) hython = prefs.software(defaults._hython_).path env = software.get_env(defaults._hython_, 0) env[defaults._asset_var_] = utils.asset_to_string(self.asset) self.ui_subprocess_manager = ui_subprocess_manager.Main([hython, "-u", file], env) build.launch_normal_as_child(self.ui_subprocess_manager, minimized = 1)
def execute_as_subprocess(self): file = utils.temp_file_from_command(self.get_code()) env = os.environ.copy() python_system = 'pywizard' if sys.argv[0].endswith('.py'): python_system = 'python pywizard.py' self.ui_subprocess_manager = ui_subprocess_manager.Main(f"{python_system} {file}", env, cwd=os.path.abspath('')) build.launch_normal_as_child(self.ui_subprocess_manager, minimized = 0)
def execute(self): if self.command != '': file = utils.temp_file_from_command(self.command) mayapy = prefs.software(defaults._mayapy_).path env = software.get_env(defaults._mayapy_, 0) env[defaults._asset_var_] = utils.asset_to_string(self.asset) self.ui_subprocess_manager = ui_subprocess_manager.Main([mayapy, "-u", file], env) build.launch_normal_as_child(self.ui_subprocess_manager, minimized = 1) else: logger.warning('Nothing to export !')
def do_playblast_1(self): if self.asset: if self.asset.software == defaults._maya_ or self.asset.software == defaults._maya_yeti_: command = 'from wizard.tools.playblast import playblast/n' command += 'playblast("{}").playblast()'.format( utils.asset_to_string(self.asset)) file = utils.temp_file_from_command(command) self.ui_subprocess_manager = ui_subprocess_manager.Main( ["python", "-u", file]) build.launch_normal_as_child(self.ui_subprocess_manager, minimized=1)
def playblast(self): if self.out_range: if self.asset.software == defaults._maya_ or self.asset.software == defaults._maya_yeti_ or self.asset.software == defaults._houdini_: show_ornaments = self.ui.playblast_ornaments_checkBox.isChecked( ) show_playblast = self.ui.playblast_show_checkBox.isChecked() items_list = self.ui.export_ma_assets_listWidget.selectedItems( ) refresh_assets = self.ui.export_m_refresh_assets_checkBox.isChecked( ) nspace_list = [] for item in items_list: nspace_list.append(item.text()) if (len(nspace_list) == 1) or (len(nspace_list) == 0): env_path = os.path.abspath('softwares_env').replace( '\\', '/') if nspace_list != []: camera = nspace_list[-1] else: camera = None command = 'import sys\nsys.path.append("{}")\n'.format( env_path) command += 'from wizard.tools.playblast import playblast\n' command += 'playblast("{}", {}, {}, is_preroll={}).playblast("{}", {}, {})'.format( utils.asset_to_string(self.asset), self.out_range, refresh_assets, self.is_preroll, camera, show_ornaments, show_playblast) file = utils.temp_file_from_command(command) python_system = 'pywizard' if sys.argv[0].endswith('.py'): python_system = 'python' env = os.environ.copy() env[defaults._asset_var_] = utils.asset_to_string( self.asset) self.ui_subprocess_manager = ui_subprocess_manager.Main( "{} {}".format(python_system, file), env) build.launch_normal_as_child(self.ui_subprocess_manager, minimized=1) self.hide() else: logger.warning("Please select one camera") else: logger.warning("Please enter a valid frame range")
def batch_export_maya(self): command = 'from softwares.maya_wizard.batch_export import batch_export\n' command += 'batch_export()' file = utils.temp_file_from_command(command) mayapy = prefs.software(defaults._mayapy_).path env = software.get_env(defaults._mayapy_, 0) env[defaults._asset_var_] = utils.asset_to_string(self.asset) self.ui_subprocess_manager = ui_subprocess_manager.Main([mayapy, "-u", file], env) build.launch_normal_as_child(self.ui_subprocess_manager, minimized = 1)
def batch_execute_script(self, script): try: file = utils.temp_file_from_command(script) env = os.environ.copy() python_system = 'pywizard' if sys.argv[0].endswith('.py'): python_system = 'python pywizard.py' self.ui_subprocess_manager = ui_subprocess_manager.Main( f'{python_system} {file}', env, cwd=os.path.abspath('')) build.launch_normal_as_child(self.ui_subprocess_manager, minimized=1) except: logger.error(str(traceback.format_exc()))
def tx_from_files(files_list, tex_creation='.tex'): command = "from wizard.tools.maketx import maketx" command += "\nmaketx({}, '{}').start()".format(files_list, tex_creation) temp_file = utils.temp_file_from_command(command) env = os.environ.copy() wizard_path = os.path.abspath('') rel_site_script_path = os.path.join(defaults._softwares_scripts_path_) abs_site_script_path = os.path.abspath(rel_site_script_path) env[defaults._script_software_env_dic_[ defaults._mayapy_]] = abs_site_script_path env[defaults._script_software_env_dic_[ defaults._mayapy_]] += os.pathsep + wizard_path + '\\softwares_env' cwd = os.path.abspath("") subprocess_manager = ui_subprocess_manager.Main( 'pywizard {}'.format(temp_file), env, cwd) build.launch_normal_as_child(subprocess_manager, minimized=1)