示例#1
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('')
示例#2
0
 def check_dir(fullpath):
     if not os.path.isdir(fullpath):
         return True
     else:
         echo(f"Project '{fullpath}' already exists.",lvl="ERROR")
         print(f'''
             Sorry!, the project already exists.
             Try creating a new project with a another name or if your looking for the
             particular project use `hou goshow [project-name]` to move in the show.
         ''')
         return False
示例#3
0
 def create_dir(self):
         # create directory
         os.mkdir(self.fullpath)
         echo("Project successfull created.")
         print(f'''
             - The project is created in the hou home directory.
             - It also created the following sub-directories
             {PRO_SUB_DIR}
             - Use `hou launch` to launch a blank houdini file.
         ''')
         
         # create sub dirctory
         self.create_sub_dir()
示例#4
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")
示例#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)