Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
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 !')
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
    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")
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
 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()))
Ejemplo n.º 8
0
def batch_asset_creation(asset, in_out):

    string_asset = utils.asset_to_string(asset)

    command = "import sys\n"
    command += "import os\n"
    command += "sys.path.append(os.path.abspath(''))\n\n"
    command += "from wizard.tools import utility as utils\n"
    command += "from wizard.asset import main as asset_core\n\n"
    command += f'asset = asset_core.string_to_asset("{string_asset}")\n'
    command += f'asset.create({in_out}, batch=1)\n'
    command += 'print("status:Done !")'

    file = utils.temp_file_from_command(command)
    return file
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
    def playblast(self, cam_namespace, ornaments, show_playblast):

        self.temp_directory = utils.temp_dir()

        if self.asset.software == defaults._maya_:
            pb_command = 'from softwares.maya_wizard.do_playblast import do_playblast\n'
            pb_command += 'do_playblast("{}", "{}", "{}", {}, {}).do_playblast("{}")'.format(
                self.string_asset, self.asset.file.replace('\\', '/'),
                self.temp_directory.replace('\\', '/'), self.frange,
                self.refresh_assets, cam_namespace)

            file = utils.temp_file_from_command(pb_command)
            print('status:Starting...')
            print('status:Working...')
            print('current_task:Playblasting...')
            sys.stdout.flush()
            mayapy = prefs.software(defaults._mayapy_).path
            env = software.get_env(defaults._mayapy_, 1)
            self.process = subprocess.Popen([mayapy, "-u", file], env=env)
            self.process.wait()

        elif self.asset.software == defaults._houdini_:
            pb_command = "from softwares.houdini_wizard import flipbook\n"
            pb_command += 'flipbook.do_flipbook("{}", "{}", {}, "{}", "{}", {})'.format(
                self.string_asset, cam_namespace, self.frange,
                self.temp_directory.replace('\\', '/'),
                self.asset.file.replace('\\', '/'), self.refresh_assets)

            file = utils.temp_file_from_command(pb_command)

            print('status:Starting...')
            print('status:Working...')
            print('current_task:Playblasting...')
            sys.stdout.flush()

            hython = prefs.software(defaults._hython_).path
            env = software.get_env(defaults._hython_, 1)
            self.process = subprocess.Popen([hython, "-u", file], env=env)
            self.process.wait()

        print('percent:33')

        print('current_task:Conforming frames...')
        sys.stdout.flush()

        focal_file = os.path.join(self.temp_directory, 'focal.txt')
        self.focal = 'none'
        if os.path.isfile(focal_file):
            with open(focal_file, 'r') as f:
                self.focal = f.readlines()[0]
            os.remove(focal_file)

        if ornaments:
            self.conform_playblast()

        print('percent:66')
        print('current_task:Creating movie file...')
        sys.stdout.flush()

        pbfile = self.create_video()
        wall().playblast_event(self.asset)

        print('percent:100')
        print('status:Done !')
        sys.stdout.flush()

        if show_playblast:
            os.startfile(pbfile)