示例#1
0
 def get_path(ref_file, get_type="image"):
     context = pipeFile.PathDetails.parse_path(ref_file)
     if not context:
         return
     project_name = context.project
     entity_type = context.entity_type
     asset_type = context.asset_type
     asset_name = context.asset_name
     current_step = context.step
     if current_step == "HighRig":
         step = "MidRig"
         task = "MidRig" if context.task == "HighRig" else context.task
     else:
         step = "HighRig"
         task = "HighRig" if context.task == "MidRig" else context.task
     if get_type == "image":
         path = pipeFile.get_task_file(project_name,
                                       asset_type,
                                       asset_name,
                                       step,
                                       task,
                                       "maya_asset_image",
                                       version="")
     else:
         path = pipeFile.get_task_publish_file(project_name, entity_type,
                                               asset_type, asset_name, step,
                                               task)
     return path
示例#2
0
文件: Lgt.py 项目: jonntd/mira
def rebuild_asset(context):
    asset_info_file = pipeFile.get_task_file(context.project, context.sequence,
                                             context.shot, "Anim", "Anim",
                                             "maya_shot_assetInfo", "")
    if not os.path.isfile(asset_info_file):
        log.warning("%s is not an exist file." % asset_info_file)
        return
    asset_info_list = json_operation.get_json_data(asset_info_file)
    if not asset_info_list:
        log.warning("No data in the json file %s." % asset_info_file)
        return
    cache_dir = get_anim_cache_dir(context)
    for asset_info in asset_info_list:
        asset_type = asset_info.get("type")
        asset_name = asset_info.get("name")
        namespace = asset_info.get("namespace")
        # project, entity_type, asset_type_sequence, asset_name_shot, step, task, version="", engine="maya"
        asset_shd_file = pipeFile.get_task_publish_file(
            context.project, "Asset", asset_type, asset_name, "Shd", "Shd")
        if os.path.isfile(asset_shd_file):
            create_reference.create_reference(asset_shd_file, namespace, True)
            log.info("Reference in %s" % asset_shd_file)
            cache_file = "%s/%s" % (cache_dir, "%s.abc" % namespace)
            if os.path.isfile(cache_file):
                log.info("attaching...")
                try:
                    import_exocortex_abc.import_exocortex_abc(cache_file)
                except:
                    log.error("Can't attach %s." % cache_file)
            else:
                log.warning("Cache: %s is not an exist file" % cache_file)
        else:
            log.warning("Shd: %s is not an exist file")
示例#3
0
def main(file_name, local):
    logger = logging.getLogger("Lookdev start")
    new_file.new_file()
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_name = context.asset_name
    # reference in Shd
    shd_publish_file = pipeFile.get_task_publish_file(project, entity_type,
                                                      asset_type, asset_name,
                                                      "Shd", "Shd")
    if not os.path.isfile(shd_publish_file):
        logger.info("%s is not an exist file" % shd_publish_file)
        return
    create_reference.create_reference(shd_publish_file, asset_name)
    logger.info("reference shd done.")
    # import hair
    load_plugin.load_plugin("xgenToolkit.mll")
    mel.eval("XgCreateDescriptionEditor;")
    publish_file = pipeFile.get_task_file(project, asset_type, asset_name,
                                          "Hair", "Hair", "maya_asset_publish",
                                          "")
    context = pipeFile.PathDetails.parse_path(publish_file)
    import_xgen_hair(context, "hair")
    logger.info("import hair done.")
    # reference turn table
    reference_turntable()
    logger.info("reference turntable done.")
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#4
0
文件: Hair_yeti.py 项目: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("Hair start")
    new_file.new_file()
    # copy low mdl publish file as mdl file
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_name = context.asset_name
    asset_type_short_name = context.asset_type_short_name
    yeti_name = "%s_%s_pgYetiMaya" % (asset_type_short_name, asset_name)
    create_yeti_node(asset_type_short_name, asset_name)
    mdl_publish_file = pipeFile.get_task_publish_file(project, entity_type,
                                                      asset_type, asset_name,
                                                      "HighMdl", "HighMdl")
    if not os.path.isfile(mdl_publish_file):
        logger.warning("No mdl file published.")
        quit_maya.quit_maya()
        return
    create_reference.create_reference(mdl_publish_file)
    create_hair_group(asset_type_short_name, asset_name)
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#5
0
 def show_path(self):
     project = self.common_widget.project
     entity_type = self.common_widget.entity_type
     asset_type_or_sequence = self.common_widget.asset_type_or_sequence
     asset_or_shot = self.common_widget.asset_or_shot
     step = self.common_widget.step
     task = self.common_widget.task
     if not all((asset_type_or_sequence, asset_or_shot, step, task)):
         return
     up_steps = Step(project, step).up_step
     if up_steps:
         up_step_published = True
         for up_step in up_steps:
             publish_file = pipeFile.get_task_publish_file(project, entity_type, asset_type_or_sequence,
                                                           asset_or_shot, up_step, up_step, "")
             if not publish_file or not os.path.isfile(publish_file):
                 up_step_published = False
                 break
         if up_step_published:
             self.can_publish(project, entity_type, asset_type_or_sequence, asset_or_shot, step, task)
         else:
             self.path_le.setText(u"上一环节没有publish")
             self.start_btn.setDisabled(True)
     else:
         self.can_publish(project, entity_type, asset_type_or_sequence, asset_or_shot, step, task)
示例#6
0
def main(file_name, local):
    logger = logging.getLogger("Hair start")
    new_file.new_file()
    # copy low mdl publish file as mdl file
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_name = context.asset_name
    # reference in mdl publish file
    asset_type_short_name = context.asset_type_short_name
    mdl_publish_file = pipeFile.get_task_publish_file(project, entity_type,
                                                      asset_type, asset_name,
                                                      "HighMdl", "HighMdl")
    if not os.path.isfile(mdl_publish_file):
        logger.warning("No mdl file published.")
        quit_maya.quit_maya()
        return
    create_reference.create_reference(mdl_publish_file)
    # create sculp group
    sculp_group = "%s_%s_SCULP" % (asset_type_short_name, asset_name)
    create_group.create_group(sculp_group)
    if local:
        create_project.create_project(os.path.dirname(file_name))
    # create project
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#7
0
文件: MidRig.py 项目: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("MidRig start")
    new_file.new_file()
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_type_short_name = context.asset_type_short_name
    asset_name = context.asset_name
    task = context.task
    MidMdl_publish_file = pipeFile.get_task_publish_file(
        project, entity_type, asset_type, asset_name, "MidMdl", "MidMdl")
    if not os.path.isfile(MidMdl_publish_file):
        logger.warning("No MidMdl file published.")
        quit_maya.quit_maya()
        return
    create_reference.create_reference(MidMdl_publish_file)
    model_name = "%s_%s_MODEL" % (asset_type_short_name, asset_name)
    # create root group
    root_group_name = "%s_%s_ROOT" % (asset_type_short_name, asset_name)
    create_group.create_group(root_group_name)
    # create _BLENDS group
    blends_group = "_BLENDS"
    create_group.create_group(blends_group)
    if asset_type == "Character":
        rig_group_name = "Grp_Master_Ctl"
        create_group.create_group("Others", root_group_name)
        create_group.create_group("Geometry", root_group_name)
        create_group.create_group(model_name, blends_group)
    elif asset_type in ["Prop", "Cprop", "Building"]:
        rig_group_name = "%s_%s_RIG" % (asset_type_short_name, asset_name)
        create_group.create_group(model_name, root_group_name)
        create_group.create_group(rig_group_name)
        if asset_type in ["Prop", "Building"]:
            bounding = mc.xform(model_name, q=1, bb=1)
            max_value = max(abs(bounding[0]), abs(bounding[2]),
                            abs(bounding[3]), abs(bounding[5]))
            radius = max_value * 1.1
            center = mc.xform(model_name, q=1, sp=1, ws=1)
            circle_list = mc.circle(c=center,
                                    nr=[0, 1, 0],
                                    r=radius,
                                    name="%s_%s_Ctl" %
                                    (asset_type_short_name, asset_name))
            circle_name = circle_list[0]
            constraint_parent = mc.parentConstraint(circle_name,
                                                    model_name,
                                                    maintainOffset=True)
            constraint_scale = mc.scaleConstraint(circle_name,
                                                  model_name,
                                                  maintainOffset=True)
            mc.parent(constraint_parent, rig_group_name)
            mc.parent(constraint_scale, rig_group_name)
            mc.parent(circle_name, rig_group_name)
    create_group.create_group(rig_group_name, root_group_name)
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#8
0
文件: Lgt.py 项目: jonntd/mira
def get_anim_cache_dir(context):
    anim_publish_file = pipeFile.get_task_publish_file(context.project, "Shot",
                                                       context.sequence,
                                                       context.shot, "Anim",
                                                       "Anim")
    anim_context = pipeFile.PathDetails.parse_path(anim_publish_file)
    cache_dir = anim_context.cache_dir
    return cache_dir
示例#9
0
def get_cache_files(context):
    AnimLay_publish_file = pipeFile.get_task_publish_file(
        context.project, "Shot", context.sequence, context.shot, "AnimLay",
        "AnimLay")
    AnimLay_context = pipeFile.PathDetails.parse_path(AnimLay_publish_file)
    cache_dir = AnimLay_context.cache_dir
    abc_files = glob.glob("%s/*.abc" % cache_dir)
    return abc_files
示例#10
0
文件: task_init.py 项目: jonntd/mira
 def set_dir(self):
     local_file = pipeFile.get_task_work_file(self.selected.project, self.selected.entity_type,
                                              self.selected.asset_type_sequence, self.selected.asset_name_shot,
                                              self.selected.step, self.selected.task, "000", local=True)
     work_file = pipeFile.get_task_work_file(self.selected.project, self.selected.entity_type,
                                             self.selected.asset_type_sequence, self.selected.asset_name_shot,
                                             self.selected.step, self.selected.task, "000")
     publish_file = pipeFile.get_task_publish_file(self.selected.project, self.selected.entity_type,
                                                   self.selected.asset_type_sequence, self.selected.asset_name_shot,
                                                   self.selected.step, self.selected.task, "000")
     self.set_widget_dir(self.local_stack, local_file)
     self.set_widget_dir(self.work_stack, work_file)
     self.set_widget_dir(self.publish_stack, publish_file)
示例#11
0
文件: task_get.py 项目: jonntd/mira
 def on_item_clicked(self, index):
     node = self.proxy_model.mapToSource(index).internalPointer()
     self.selected = node
     if node.node_type != "task":
         return
     entity_type = node.entity_type
     asset_type_sequence = node.parent().name
     asset_name_shot = node.name.split("_")[-1]
     step = node.step
     task = node.task
     status = node.status
     status_color = node.status_color
     due_date = node.due_date
     # show path
     local_file = pipeFile.get_task_work_file(self.project,
                                              entity_type,
                                              asset_type_sequence,
                                              asset_name_shot,
                                              step,
                                              task,
                                              "000",
                                              local=True)
     work_file = pipeFile.get_task_work_file(self.project, entity_type,
                                             asset_type_sequence,
                                             asset_name_shot, step, task,
                                             "000")
     publish_file = pipeFile.get_task_publish_file(self.project,
                                                   entity_type,
                                                   asset_type_sequence,
                                                   asset_name_shot, step,
                                                   task, "000")
     local_dir = os.path.dirname(os.path.dirname(local_file))
     work_dir = os.path.dirname(os.path.dirname(work_file))
     publish_dir = os.path.dirname(os.path.dirname(publish_file))
     if self.__engine != "python":
         local_dir = join_path.join_path2(local_dir, self.__engine)
         work_dir = join_path.join_path2(work_dir, self.__engine)
         publish_dir = join_path.join_path2(publish_dir, self.__engine)
     self.local_file_widget.set_dir(local_dir)
     self.work_file_widget.set_dir(work_dir)
     self.publish_file_widget.set_dir(publish_dir)
     # show status and due_date
     self.status_label.setText("<font size=4 color=%s><b>%s</b></font>" %
                               (status_color, status))
     self.due_label.setText("<font size=4 color=#ff8c00>%s</font>" %
                            due_date)
示例#12
0
def main(file_name, local):
    logger = logging.getLogger("HairRig start")
    context = pipeFile.PathDetails.parse_path(file_name)
    #  reference HighRig
    high_rig_file = pipeFile.get_task_publish_file(context.project, context.entity_type, context.asset_type,
                                                   context.asset_name, "HighRig", "HighRig")
    if not os.path.isfile(high_rig_file):
        logger.error("HighRig not publish file yet.")
        if not local:
            quit_maya.quit_maya()
        return
    create_reference.create_reference(high_rig_file)
    #  save file
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#13
0
文件: Shd.py 项目: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("shd start")
    new_file.new_file()
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_name = context.asset_name
    mdl_publish_file = pipeFile.get_task_publish_file(project, entity_type,
                                                      asset_type, asset_name,
                                                      "HighMdl", "HighMdl")
    if not os.path.isfile(mdl_publish_file):
        logger.warning("No model file published.")
        quit_maya.quit_maya()
        return
    create_reference.create_reference(mdl_publish_file)
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#14
0
文件: Anim.py 项目: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("Anim start")
    new_file.new_file()
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    sequence = context.sequence
    shot = context.shot
    task = "AnimLay" if context.task == "Anim" else context.task
    lay_publish_file = pipeFile.get_task_publish_file(project, "Shot", sequence, shot, "AnimLay", task)
    if not os.path.isfile(lay_publish_file):
        logger.warning("%s is not an exist file" % lay_publish_file)
        if local:
            return
        else:
            quit_maya.quit_maya()
    copy.copy(lay_publish_file, file_name)
    logger.info("copy %s to %s" % (lay_publish_file, file_name))
    if local:
        open_file.open_file(file_name)
    else:
        quit_maya.quit_maya()
示例#15
0
def main(file_name, local):
    logger = logging.getLogger("HighMdl start")
    new_file.new_file()
    # copy low mdl publish file as mdl file
    context = pipeFile.PathDetails.parse_path(file_name)
    project = context.project
    entity_type = context.entity_type
    asset_type = context.asset_type
    asset_name = context.asset_name
    MidMdl_publish_file = pipeFile.get_task_publish_file(
        project, entity_type, asset_type, asset_name, "MidMdl", "MidMdl")
    logger.info("MidMdl publish file: %s" % MidMdl_publish_file)
    if not os.path.isfile(MidMdl_publish_file):
        logger.warning("No MidMdl file published.")
        if not local:
            quit_maya.quit_maya()
        return
    open_file.open_file(MidMdl_publish_file)
    save_as.save_as(file_name)
    logger.info("%s publish successful!" % file_name)
    if not local:
        quit_maya.quit_maya()
示例#16
0
 def get_error_topology():
     model_name = get_model_name.get_model_name()
     # reference_file = mc.referenceQuery(model_name, filename=1, withoutCopyNumber=1)
     context = pipeFile.PathDetails.parse_path()
     project = context.project
     entity_type = context.entity_type
     asset_type = context.asset_type
     asset_name = context.asset_name
     HighMdl_file = pipeFile.get_task_publish_file(project, entity_type,
                                                   asset_type, asset_name,
                                                   "HighMdl", "HighMdl")
     context = pipeFile.PathDetails.parse_path(HighMdl_file)
     topology_path = context.topology_path
     if not os.path.isfile(topology_path):
         return
     ho = hierarchy_opt.HierarchyOpt(model_name)
     increase, decrease = ho.compare_hierarchy(topology_path)
     if all((increase, decrease)):
         return increase, decrease
     else:
         change_list = ho.compare_topology(topology_path)
         return change_list
示例#17
0
# -*- coding: utf-8 -*-
import maya.cmds as mc
from miraLibs.pipeLibs import pipeFile
from miraLibs.mayaLibs import open_file


assets = [u'SSWHwovenbag', u'SSWHpiano', u'SSWHpianostool', u'SSWHironbox', u'SSWHpaperbox', u'SSWHvase', u'SSWHrottencarton', u'SSWHleathersuitcaseA', u'SSWHleathersuitcaseB', u'SSWHstorageboxA', u'SSWHstorageboxB', u'SSWHstorageboxC', u'SSWHstorageboxD', u'SSWHstorageboxE', u'SSWHstorageboxF', u'SSWHbooksA', u'SSWHbooksB', u'SSWHbooksC', u'SSWHbooksD', u'SSWHbooksE', u'SSWHbooksF', u'SSWHbooksG', u'SSWHbooksH', u'SSWHbooksI', u'SSWHbooksJ', u'SSWHplasticcrate', u'SSWHstickerA', u'SSWHstickerB', u'SSWHstickerC', u'SSWHstringbag', u'SSWHtoyball', u'SSWHphotoframe', u'SSWHshoebox', u'SSWHcartonA', u'SSWHcartonB', u'SSWHcartonC', u'SSWHcartonD', u'SSWHcartonE', u'SSWHcartonF', u'SSWHcartonG', u'SSWHcartonH', u'SSWHcartonJ', u'SSWHcartonK', u'SSWHcartonL', u'SSWHcartonM', u'SSWHcartonN', u'SSOSmailbox', u'SSOSpowerdistributionbox', u'SSWHwoodA', u'SSWHwoodB', u'SSWHwoodC', u'TdTest', u'TdTest', u'SSWRlittleglasspot', u'SSWRcloset', u'SSWRpylons', u'SSWRglasspotB', u'SSWRglasspotA', u'SSWRfoodbasket', u'SSWRcookingbench', u'SSWRcabinet']


for asset in assets:
    ad_file = pipeFile.get_asset_AD_file("SnowKidTest", "Prop", asset)
    open_file.open_file(ad_file)
    ad_node = "prop_%s_AD" % asset
    all_representation = mc.assembly(ad_node, q=1, listRepresentations=1)
    for rep in all_representation:
        if rep in ["MidRig", "HighRig"]:
            mc.assembly(ad_node, edit=True, deleteRepresentation=rep)
            new_path = pipeFile.get_task_publish_file("SnowKidTest", "Asset", "Prop", asset, rep, rep)
            mc.assembly(ad_node, e=1, createRepresentation="Scene", repName=rep, input=new_path)
            all_representation = mc.assembly(ad_node, q=1, listRepresentations=1)
            index = all_representation.index(rep)
            if rep:
                mc.setAttr("%s.rep[%s].rla" % (ad_node, index), rep, type="string")
示例#18
0
文件: MidMdl.py 项目: jonntd/mira
# -*- coding: utf-8 -*-
import os
from miraLibs.pipeLibs import pipeFile
from miraLibs.mayaLibs import export_gpu_cache, open_file
from miraLibs.stLibs import St

st = St.St("SnowKidTest")
assets = st.get_all_assets("Prop")

prop_assets = [
    asset.get("name") for asset in assets
    if asset.get("name").startswith("SSWH")
]

for asset in prop_assets:
    publish_path = pipeFile.get_task_publish_file("SnowKidTest", "Asset",
                                                  "Prop", asset, "MidMdl",
                                                  "MidMdl")
    if not os.path.isfile(publish_path):
        continue
    open_file.open_file(publish_path)
    context = pipeFile.PathDetails.parse_path(publish_path)
    model_name = "%s_%s_MODEL" % (context.asset_type_short_name,
                                  context.asset_name)
    directory = os.path.dirname(context.abc_cache_path)
    filename = os.path.splitext(os.path.basename(context.abc_cache_path))[0]
    export_gpu_cache.export_gpu_cache(model_name, directory, filename)
    print "%s export abc done." % asset
示例#19
0
文件: entity_ui.py 项目: jonntd/mira
 def __get_publish_path(self, entity_type, typ, name, step, task):
     publish_file_path = pipeFile.get_task_publish_file(
         self.project, entity_type, typ, name, step, task)
     return publish_file_path