Ejemplo n.º 1
0
 def goshow_data(cls):
     # show file path
     cls.read_config = read_yaml(CONFIG_FILE_PATH)
     cls.shows_json_file_path = os.path.join(
         cls.read_config['base_show_path'], 'Shows.json')
     cls.show_json_data = read_json(cls.shows_json_file_path)
     return cls.show_json_data
Ejemplo n.º 2
0
    def add_to_json(self):
        time = strftime("%d %b %Y", gmtime())
        data = {"name":self.name, "short-name":self.short_name, "description":self.desc, "created-on":time}

        path = os.path.join(self.path, 'Shows.json')
        read_data = read_json(path)
        read_data['shows'].append(data)
        dump_json(path, read_data)
Ejemplo n.º 3
0
    def create_asset_directory(cls, asset_name,type,desc):
        # base show directory
        show_directory = os.getcwd()

        # check asset name for spaces
        asset_name = asset_name.replace(' ', '-')


        # create asset directory
        asset_directory_path = os.path.join(show_directory, 'assets', type, asset_name)
        os.mkdir(asset_directory_path)

        # create sub directory
        for dir in cls.asset_sub_dir:
            path = os.path.join(asset_directory_path, dir)
            os.mkdir(path)

        # add data to asset_build.lv file
        asset_lv_file = os.path.join(show_directory, 'assets', 'asset.lv')
        created_on = strftime("%d %b %Y", gmtime())

        asset_details = {"name": asset_name,
        "created-on":created_on,
        "publishes":{
            "zfile":[],
            "model":[],
            "rig":[],
            "animation":[],
            "groom":[],
            "cfx":[],
            "fx":[],
            "lookDev":[]
        }
        }

        '''
        model: alembic / usd / obj
        rig: Maya file / nxt-script
        animation: Maya file
        groom: houdini file
        cfx: houdini file / Ziva (maya file)
        fx: houidni file
        lookDev: houdini / katana / maya

        '''

        data = read_json(asset_lv_file)
        data['assets'][type].append(asset_details)

        # dump data
        dump_json(asset_lv_file, data)

        asset_lvl_file_path = os.path.join(asset_directory_path, 'asset.lvl')
        
        dump_json(asset_lvl_file_path, asset_details)
Ejemplo n.º 4
0
    def create_seq(cls, seq_name):

        # READ SHOTS DATA
        shots_level_file = os.path.join(os.getcwd(), 'shots', 'shots.lvl')

        data = read_json(shots_level_file)
        BASE_SEQ = 400
        if len(data['all_seq']) == 0:
            if seq_name:
                seq_num = str(BASE_SEQ) + '_' + seq_name
            else:
                seq_num = str(BASE_SEQ)

            seq_num_only = seq_num[:3]

            data['all_seq'].append(str(seq_num_only))

        else:
            last_seq_number = data['all_seq'][-1][:3]
            seq_num = int(last_seq_number) + 1

            if seq_name:
                seq_num = str(seq_num) + "_" + seq_name

            # Strip the name
            seq_num = str(seq_num)
            seq_num_only = seq_num[:3]

            data['all_seq'].append(str(seq_num_only))

        seq_path = os.path.join(os.getcwd(), 'shots', str(seq_num))

        # Create directories
        os.mkdir(seq_path)

        created_on = strftime("%d %b %Y", gmtime())

        # create shot json file
        seq_data = {"sequence": seq_num, "created-on": created_on, "shots": []}

        data['shots']['sequences'].append(seq_data)

        seq_level_file = os.path.join(seq_path, 'seq.lvl')
        dump_json(seq_level_file, seq_data)

        dump_json(shots_level_file, data=data)

        ## MESSAGE
        el.echo("New Sequence Created")
        el.echo(f"{seq_num}")
Ejemplo n.º 5
0
    def create_directory(cls,asset_name,type,desc):

        # base show directory
        show_directory = os.getcwd()

        # check asset name for spaces
        asset_name = asset_name.replace(' ', '-')


        # create asset directory
        asset_directory_path = os.path.join(show_directory, 'asset_build', type, asset_name)
        os.mkdir(asset_directory_path)

        # create sub directory
        for dir in cls.asset_build_sub_dir:
            path = os.path.join(asset_directory_path, dir)
            os.mkdir(path)

        # add data to asset_build.lv file
        asset_build_lv_file = os.path.join(show_directory, 'asset_build', 'asset_build.lv')
        created_on = strftime("%d %b %Y", gmtime())

        asset_details = {"name": asset_name,
        "created-on":created_on,
        "publishes":[],
        "build_files":{
            "zfile":[],
            "model":[],
            "rig":[],
            "animation":[],
            "groom":[],
            "cfx":[],
            "fx":[],
            "lookDev":[],
            "comp":[]
        }
        }

        data = read_json(asset_build_lv_file)
        data['assets'][type].append(asset_details)

        # dump data
        dump_json(asset_build_lv_file, data)

        asset_lvl_file_path = os.path.join(asset_directory_path, 'asset.lvl')
        
        dump_json(asset_lvl_file_path, asset_details)
Ejemplo n.º 6
0
    def add_to_json(self, short_name, desc):

        time = strftime("%d %b %Y", gmtime())
        data = {
            "name": self.show_name,
            "short-name": short_name,
            "description": desc,
            "createdon": time
        }

        # adding to main json file
        path = os.path.join(self.base_dir, 'Shows.json')
        read_data = read_json(path)
        read_data['shows'].append(data)
        dump_json(path, read_data)

        # add show level file
        show_level_file = os.path.join(self.base_dir, self.show_name,
                                       "show.lv")
        dump_json(show_level_file, data)
Ejemplo n.º 7
0
    def asset_list(cls):

        # get current show name
        show_name = Path.show_name(os.getcwd())
        if show_name:
            path =os.path.join(show_name, 'asset_build', 'asset_build.lv')
            data = read_json(path)
            for asset in data['assets']:
                p_data_1 = f'''
                {asset} '''
                print(p_data_1)
                for i in data['assets'][asset]:
                    print_data = f'''
                    Name: {i['name']}
                    Created-on: {i['created-on']}
                    Publishes: {i['publishes']}
                    Command:
                    el asset -t {asset} -a {i['name']}
                    -----------------------------
                    '''
                    print(print_data)
Ejemplo n.º 8
0
    def create_shot(cls, seq_num):
        shots_level_file = os.path.join(os.getcwd(), 'shots', 'shots.lvl')

        data = read_json(shots_level_file)
        SHOT_PREFIX = data['PREFIX'] + "_"

        BASE_SHOT_NUM = 200
        check = False

        # check if the seq exists
        sequences = data['all_seq']
        shots = data['all_shots']

        if seq_num in sequences:
            check = True
            if len(shots) == 0:
                shot_num = SHOT_PREFIX + str(BASE_SHOT_NUM)

            else:
                last_shot_num = int(shots[-1][3:])
                shot_num = SHOT_PREFIX + str(int(last_shot_num) + 1)

        # ADD TO ALL_SHOTS
        data['all_shots'].append(shot_num)

        index = 0
        if check:
            seq_data = data['shots']['sequences']

            for seq in seq_data:
                if seq['sequence'].startswith(seq_num):
                    break

                else:
                    index = index + 1

            data['shots']['sequences'][index]['shots'].append(shot_num)

        seq_name = data['shots']['sequences'][index]['sequence']
        shot_num = shot_num

        # CREATE DIRECTORIES
        shot_path = os.path.join(os.getcwd(), 'shots', seq_name, shot_num)
        os.mkdir(shot_path)

        dump_json(shots_level_file, data)
        # SHOTS SUB DIRECTORIES

        # SHOTS JSON DATA
        created_on = strftime("%d %b %Y", gmtime())

        SHOT_DATA = {
            "sequence": seq_name,
            "shot_num": shot_num,
            "created-on": created_on
        }

        shot_lvl_file = os.path.join(shot_path,
                                     seq_name[:3] + '_' + shot_num + '.lv')

        dump_json(shot_lvl_file, SHOT_DATA)

        # ADD DATA TO SEQ LEVEL FILE
        seq_lvl_file = os.path.join(os.getcwd(), 'shots', seq_name, 'seq.lvl')
        data = {"shot_num": shot_num, "created-on": created_on}

        seq_lvl_data = read_json(seq_lvl_file)
        seq_lvl_data['shots'].append(data)
        # print(seq_lvl_data)
        dump_json(seq_lvl_file, seq_lvl_data)

        # create shot sub directory
        sub_dir_list = [
            'animation', 'fx', 'cfx', 'cache', 'maya', 'houdini', 'render',
            'comp', 'lighting'
        ]
        for sub_dir in sub_dir_list:
            path = os.path.join(shot_path, sub_dir)
            os.mkdir(path)