Пример #1
0
 def __init__(self, asset, reference=None):
     # Init the " asset " and software preferences before
     # launching it
     self.asset = asset
     self.path = os.path.dirname(self.asset.work)
     self.executable = prefs.software(self.asset.software).path
     #self.sct = sct
     self.reference = reference
     env = prefs.software(self.asset.software).env
Пример #2
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)
Пример #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 !')
Пример #4
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)
Пример #5
0
def get_cmd(software, file, reference=None):

    cmd = _cmd_dic_[software]

    if software == defaults._painter_ and not reference:
        cmd = _default_cmd_

    executable = prefs.software(software).path
    cmd = cmd.replace(_executable_key_, executable)

    cmd = cmd.replace(_file_key_, file)

    if _script_key_ in cmd:
        cmd = cmd.replace(_script_key_, _scripts_dic_[software])

    if reference and _reference_key_ in cmd:
        cmd = cmd.replace(_reference_key_, reference)

    logger.debug(cmd)

    return cmd
Пример #6
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)