Beispiel #1
0
 def get_abc(self, full_path, listWidget_abc):
     listWidget_abc.clear_item()
     abc_list = filter(lambda x: os.path.splitext(x)[-1] == '.abc',
                       os.listdir(full_path))
     rig_info_file = os.path.join(full_path, 'rigging_info.json')
     if os.path.isfile(rig_info_file):
         rigging_dict = utils.read_in_json(
             os.path.join(full_path, 'rigging_info.json'))
         for abc in abc_list:
             abc_path = os.path.join(str(full_path), abc.encode())
             asset_name = abc.rsplit('.', 1)[0].rsplit('_', 1)[-1]
             rigging_path = rigging_dict[asset_name].values()[0]
             naming = NamingAPI.parser(rigging_path)
             naming.task = 'shd'
             latest_shd_path = os.path.dirname(naming.get_latest_version())
             metadata = {
                 'abc_name':
                 abc,
                 'abc_path':
                 abc_path,
                 'namespace':
                 abc.rsplit('.', 1)[0],
                 'asset_name':
                 asset_name,
                 'shader_path':
                 os.path.join(latest_shd_path, '{}.ma'.format(asset_name)),
                 'json_path':
                 os.path.join(latest_shd_path, '{}.json'.format(asset_name))
             }
             listWidget_abc.add_item(basic_gui.MotionItem(abc, enable=True),
                                     metadata)
Beispiel #2
0
def get_match_path(file_path, task=None):
    naming = NamingAPI.parser(file_path)
    naming.version = '*'
    current_task = naming.parser(file_path).task
    naming.task = task if task else current_task
    match_path = naming.get_publish_full_path()
    return match_path
Beispiel #3
0
    def __init__(self, parent=None):
        super(PreviewWidget, self).__init__(parent)
        self.setWindowTitle('Lighting import tool')
        self.current_file_path = core.get_current_scene_file()
        try:
            NamingAPI.parser(self.current_file_path)
        except RuntimeError:
            om.MGlobal.displayWarning(
                'Please open a lgt file that give a legal path.')
            return

        ui_file = os.path.join(os.path.dirname(__file__), 'win.ui')
        _loadUi(ui_file, self)
        self.init_ui()
        self.init_layout()
        self.init_connectiond()
        self.get_abc_from_version()
        self.get_lay_abc_from_version()
Beispiel #4
0
def save_maya_file(export_path=None):
    from hz.naming_api import NamingAPI
    file_path = pm.system.saveFile(force=True)
    naming = NamingAPI.parser(file_path)
    export_source_path = export_path if export_path else naming.get_publish_full_path(
    )
    root_path = os.path.dirname(export_source_path)
    if not os.path.exists(root_path):
        os.makedirs(root_path)
    file_path.copyfile(export_source_path)
Beispiel #5
0
def get_export_root_path(create=False):
    import pymel.core as pm
    from hz.naming_api import NamingAPI
    file_path = pm.sceneName()
    naming = NamingAPI.parser(file_path)
    export_source_path = naming.get_publish_full_path()
    # 'D:/dev/jojo/temp_test/temp'
    export_root_path = os.path.dirname(export_source_path)
    if create and not os.path.exists(export_root_path):
        os.makedirs(export_root_path)
    return export_root_path
Beispiel #6
0
def get_certain_version(file_path, version, task):
    """

    :param str file_path:
    :param str version: eg:001
    :return:
    """
    naming = NamingAPI.parser(file_path)
    naming.version = version
    naming.task = task
    match_path = naming.get_publish_full_path()
    return match_path
Beispiel #7
0
def get_all_published_versions(file_path, task=None):
    """
    Get all publish version from task
    :param str file_path: path
    :param str task: task which want to get all versions
    :return:
    """
    match_path = get_match_path(file_path, task)
    version_list = []
    naming = NamingAPI.parser(file_path)
    for path in glob.glob(match_path):
        version = naming.parser(path).version
        if version not in version_list:
            version_list.append(version)
    return version_list