示例#1
0
    def scene_file(cls, hou_file_path):
        # list directory
        hou_file_data = read_json(hou_file_path)
        if len(hou_file_data['hip_files']) > 0:
            latest_file = hou_file_data['hip_files'][-1]
            # check if the last file exists
            cwd = os.getcwd()
            lastest_file_path = os.path.join(cwd, latest_file)
            if os.path.isfile(lastest_file_path):
                print(f'''
                Launching a the latest working file > {latest_file}.
                Happy Hacking!
                ''')
                os.system(f"cmd.exe /c start houdini {latest_file}")

            else:
                echo(
                    f"The file {latest_file} in the log data doesn't not exists in the directory.",
                    lvl="WARNNING")
                echo("Please check the directory and update the log file.")

        else:
            echo('Launching a Blank Houdini file.')
            print('''
            Happy Hacking!
            ''')
            os.system("cmd.exe /c start houdini")
示例#2
0
文件: cli.py 项目: deepakxyz/Elna
    def log_lastShow(self, proname):
        log_file_path = os.path.join(self.base_path, self.log_json)
        log_data = read_json(log_file_path)
        log_data['last_show'] = proname

        # dump the data
        dump_json(log_file_path, log_data)
示例#3
0
    def add_to_json(self):
        time = strftime("%d %b %Y", gmtime())
        data = {"name":self.name, "description":self.desc,"path":self.fullpath ,"created-on":time,"otls":[]}

        path = os.path.join(self.path, 'houdini.json')
        read_data = read_json(path)
        read_data['projects'].append(data)
        dump_json(path, read_data)
示例#4
0
    def otls_list(base_path):
        # read houdini json file
        houdini_json_file_path = os.path.join(base_path, 'houdini.json')
        houdini_json_data = read_json(houdini_json_file_path)

        for otls in houdini_json_data['otls']:
            otls_name = otls['path'].split('/')
            echo(f'New otls published > {otls_name[-1]}')
            echo(f'Description: {otls["description"]}')
            print('')
示例#5
0
    def check(base_path):
        # read houdini json file
        houdini_json_file_path = os.path.join(base_path, 'houdini.json')
        houdini_json_data = read_json(houdini_json_file_path)

        for project in houdini_json_data['projects']:
            # hou file path of each project
            hou_file_path = os.path.join(base_path, project['name'], 'hou')
            # if hou file exists
            if os.path.isfile(hou_file_path):
                # read hou file
                hou_data = read_json(hou_file_path)

                for hou_otls in hou_data['otls']:
                    if not hou_otls in project['otls']:
                        project['otls'].append(hou_otls)

                        otls_name = hou_otls['path'].split('/')
                        echo(f"Project: {project['name']}")
                        echo(f'New otls published > {otls_name[-1]}')
                        echo(f'Description: {hou_otls["description"]}')
                        print('')

                        # copy and paste file
                        target_file = os.path.join(base_path, '_otls',
                                                   otls_name[-1])
                        original_file = hou_otls['path']

                        shutil.copyfile(original_file, target_file)

                dump_json(houdini_json_file_path, houdini_json_data)

            else:
                pro_name = project['name']
                echo(f'`hou` file does not exists in the project {pro_name}')

            # add data to houdini.json otls
            for otls in project['otls']:
                if not otls in houdini_json_data['otls']:
                    houdini_json_data['otls'].append(otls)

                dump_json(houdini_json_file_path, houdini_json_data)
示例#6
0
    def otls_force_update(base_path, cwd):
        # read houdini json file
        houdini_json_file_path = os.path.join(base_path, 'houdini.json')
        houdini_json_data = read_json(houdini_json_file_path)

        for project in houdini_json_data['projects']:
            # hou file path of each project
            echo('Force updating all the Otls in the current project.')
            for hou_otls in (project['otls']):
                otls_name = hou_otls['path'].split('/')
                echo(f"Project: {project['name']}")
                echo(f'New otls published > {otls_name[-1]}')
                echo(f'Description: {hou_otls["description"]}')
                print('')

                # copy and paste file
                target_file = os.path.join(base_path, '_otls', otls_name[-1])
                original_file = hou_otls['path']

                shutil.copyfile(original_file, target_file)
示例#7
0
文件: cli.py 项目: deepakxyz/Elna
 def log_getShow(self):
     log_file_path = os.path.join(self.base_path, self.log_json)
     log_data = read_json(log_file_path)
     last_show = log_data['last_show']
     return last_show
示例#8
0
文件: cli.py 项目: deepakxyz/Elna
 def getJsonData(self):
     file_path = os.path.join(self.base_path, self.houdini_json)
     data = read_json(file_path)
     return data