예제 #1
0
파일: Anim.py 프로젝트: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("Anim publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    publish_path = context.publish_path
    # reference opt
    publish.reference_opt()
    # copy image and video
    publish.copy_image_and_video(context)
    logger.info("Copy image and video done.")
    # save to publish path
    copy.copy(file_name, publish_path)
    logger.info("Copy to %s" % publish_path)
    # export asset info
    asset_info_path = context.asset_info_path
    export_anim_asset_info.export_anim_asset_info(asset_info_path)
    logger.info("Export asset info done.")
    # write out assembly edits
    rebuild_assembly.export_scene()
    logger.info("Export assembly edits done.")
    # export cache
    publish.export_cache(context)
    logger.info("Export cache done.")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #2
0
파일: HighMdl.py 프로젝트: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("HighMdl publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    asset_type = context.asset_type
    # copy image and video
    publish.copy_image_and_video(context)
    logger.info("copy image and video done.")
    # export _MODEL group to publish path
    publish.export_need_to_publish(context)
    logger.info("Export _MODEL group to publish done.")
    # export abc cache
    publish.export_model_to_abc(context)
    logger.info("Export abc done.")
    # write out topology
    if asset_type in ["Character", "Prop", "Cprop"]:
        # write out topology
        topology_path = context.topology_path
        model_name = get_model_name.get_model_name()
        ho = hierarchy_opt.HierarchyOpt(model_name)
        ho.write_out(topology_path)
        logger.info("write out topology done.")
    # add to AD file
    publish.add_high_mdl_ad(context)
    logger.info("Add to AD done.")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #3
0
def main():
    logger = logging.getLogger(__name__)
    scene_name = get_scene_name.get_scene_name()
    # copy scene to temp dir
    base_name = os.path.basename(scene_name)
    temp_dir = tempfile.gettempdir()
    temp_file = join_path.join_path2(temp_dir, base_name)
    shutil.copy(scene_name, temp_file)
    logger.info("Copy to temp: %s" % temp_file)
    # copy all textures to _tex
    # if modified, backup it
    try:
        export_shd_textures.export_shd_textures()
    except:
        raise Exception("something wrong with export shd textures.")
    # save current file
    save_file.save_file()
    # copy to QCPublish path
    obj = pipeFile.PathDetails.parse_path()
    project = obj.project
    QCPublish_path = obj.QCPublish_path
    backup.backup(project, scene_name)
    Copy.copy(scene_name, QCPublish_path)
    logger.info("copy %s >> %s" % (scene_name, QCPublish_path))
    # copy from temp file
    shutil.copy(temp_file, scene_name)
    # delete temp file
    os.remove(temp_file)
    # open scene name
    open_file.open_file(scene_name)
    logger.info("Reopen %s" % scene_name)
예제 #4
0
파일: Shd.py 프로젝트: jonntd/mira
def main():
    logger = logging.getLogger(__name__)
    scene_name = get_scene_name.get_scene_name()
    # copy scene to temp dir
    base_name = os.path.basename(scene_name)
    temp_dir = tempfile.gettempdir()
    temp_file = join_path.join_path2(temp_dir, base_name)
    copy.copy(scene_name, temp_file)
    logger.info("Copy to temp: %s" % temp_file)
    # copy all textures to _tex
    try:
        export_shd_textures.export_shd_textures()
    except:
        raise Exception("something wrong with export shd textures.")
    # save current file
    save_file.save_file()
    # copy to QCPublish path
    context = pipeFile.PathDetails.parse_path()
    work_path = context.work_path
    if Copy.copy(scene_name, work_path):
        logger.info("copy %s >> %s" % (scene_name, work_path))
    else:
        raise RuntimeError("copy to work path error.")
    # copy from temp file
    copy.copy(temp_file, scene_name)
    logger.info("copy from temp.")
    # delete temp file
    os.remove(temp_file)
    # open scene name
    open_file.open_file(scene_name)
    logger.info("Reopen %s" % scene_name)
예제 #5
0
def main(file_name, local):
    logger = logging.getLogger("Hair publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    hair_cache_path = context.abc_cache_path
    hair_path = context.hair_path
    delta_path = context.delta_path
    asset_name = context.asset_name
    # import reference
    publish.reference_opt()
    # copy image
    publish.copy_image_and_video(context)
    logger.info("Copy image done.")
    # export SCULP group to abc
    model_name = get_model_name.get_model_name("hair")
    export_abc.export_abc(1, 1, hair_cache_path, model_name)
    logger.info("Export abc done.")
    # export xgen file
    collection_node = str("%s_collection" % asset_name)
    xgen = Xgen.Xgen()
    xgen.export_palette(collection_node, hair_path)
    xgen.create_delta(collection_node, delta_path)
    logger.info("Export .xgen file done.")
    # export shd
    export_shd(context)
    logger.info("Export shader done.")
    save_as.save_as(context.publish_path)
    if not local:
        quit_maya.quit_maya()
예제 #6
0
def main():
    logger = logging.getLogger(__name__)
    obj = pipeFile.PathDetails.parse_path()
    tex_dir = obj.tex_dir
    work_path = obj.work_path
    # save to temp file
    scene_name = get_scene_name.get_scene_name()
    temp_file = get_temp_file(scene_name)
    Copy.copy(scene_name, temp_file)
    logger.info("save to temp file done.")
    # copy all textures to _tex
    publish_textures(tex_dir)
    set_hair_textures(tex_dir)
    set_yeti_textures(tex_dir)
    logger.info("publish texture done.")
    # save current file
    save_file.save_file()
    # copy to QCPublish path
    Copy.copy(scene_name, work_path)
    logger.info("copy to work path done.")
    # copy from temp file
    Copy.copy(temp_file, scene_name)
    # delete temp file
    os.remove(temp_file)
    # open scene name
    open_file.open_file(scene_name)
    logger.info("Reopen %s" % scene_name)
예제 #7
0
def main(file_name, local):
    logger = logging.getLogger("Lookdev publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path()
    publish.copy_image_and_video(context)
    logger.info("copy image and video done.")
    save_as.save_as(context.publish_path)
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #8
0
파일: Shd.py 프로젝트: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("shd publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    publish_path = context.publish_path
    publish.copy_image_and_video(context)
    logger.info("copy image and video done.")
    # import all reference
    publish.reference_opt()
    logger.info("Import all reference.")
    # unlock normals
    unlock_normals()
    # delete history and delete unused nodes
    delete_history.delete_history()
    delete_unused_nodes.delete_unused_nodes()
    # delete intermediate object
    delete_intermediate_object.delete_intermediate_object()
    logger.info("Delete intermediate_object done.")
    # remove namespace
    remove_namespace.remove_namespace()
    logger.info("Remove namespace done.")
    # rename mat node
    model_name = get_model_name.get_model_name()
    mc.select(model_name, r=1)
    rename_shd_mat_node(context)
    logger.info("Rename material name done.")
    # rename shape
    if not rename_pipeline_shape.rename_pipeline_shape():
        raise RuntimeError("Rename shape error.")
    logger.info("Rename shape done.")
    # export _MODEL to publish path
    delete_layer.delete_layer()
    export_selected.export_selected(publish_path)
    logger.info("Export to %s" % publish_path)
    # export material
    publish.export_material(context)
    logger.info("Export material done.")
    # export connection
    publish.export_connection(context)
    logger.info("Export connection done.")
    # convert image
    convert_image(context)
    logger.info("Convert image done.")
    # add to AD
    publish.add_mesh_to_ad(context)
    logger.info("Add to AD done.")
    if not local:
        quit_maya.quit_maya()
예제 #9
0
파일: MidRig.py 프로젝트: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("MidRig publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    # copy image
    publish.copy_image_and_video(context)
    logger.info("Copy image and video done.")
    # import all reference
    publish.reference_opt()
    logger.info("Import reference done.")
    # export needed
    publish.export_need_to_publish(context, "rig")
    logger.info("Export to publish path done.")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #10
0
def main(file_name, local):
    logger = logging.getLogger("Group publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    # copy image and video
    publish.copy_image_and_video(context)
    logger.info("copy image and video done.")
    # copy to publish path
    copy.copy(file_name, context.publish_path)
    logger.info("Copy to publish path.")
    # generate AD file
    publish.create_ad(context)
    logger.info("Create AD done.")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #11
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()
예제 #12
0
파일: Hair_yeti.py 프로젝트: jonntd/mira
def main(file_name):
    logger = logging.getLogger("hair publish")
    open_file.open_file(file_name)
    obj = pipeFile.PathDetails.parse_path(file_name)
    asset_type_short_name = obj.asset_type_short_name
    asset_name = obj.asset_name
    publish_path = obj.publish_path
    hair_path = obj.hair_path
    yeti_group = "%s_%s_yetiNode" % (asset_type_short_name, asset_name)
    # import mdl reference
    import_load_remove_unload_ref.import_load_remove_unload_ref()
    # export yeti group to _hair group
    delete_layer.delete_layer()
    mc.select(yeti_group, r=1)
    export_selected.export_selected(hair_path)
    logger.info("export yeti node to _hair done.")
    mc.delete(yeti_group)
    # save to publish path
    save_as.save_as(publish_path)
    # quit maya
    quit_maya.quit_maya()
예제 #13
0
파일: LgtLay.py 프로젝트: jonntd/mira
def main(file_name, local):
    logger = logging.getLogger("LgtLay publish")
    if not local:
        open_file.open_file(file_name)
    # delete Env
    try:
        mc.delete("Env")
    except:
        print "Can't delete Env"
    context = pipeFile.PathDetails.parse_path()
    publish.copy_image_and_video(context)
    # export Lights to _light
    mc.select("Lights", r=1)
    export_selected.export_selected(context.light_path)
    logger.info("Export Lights to %s" % context.light_path)
    # copy to publish path
    copy.copy(file_name, context.publish_path)
    logger.info("Copy to publish path")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #14
0
def main():
    logger = logging.getLogger(__name__)
    scene_name = get_scene_name.get_scene_name()
    context = pipeFile.PathDetails.parse_path()
    asset_name = context.asset_name
    collection_node = "%s_collection" % asset_name
    # copy scene and .xgen file to temp dir
    base_name = os.path.basename(scene_name)
    xgen_base_name = mc.getAttr("%s.xgFileName" % collection_node)
    xgen_path = join_path.join_path2(os.path.dirname(scene_name),
                                     xgen_base_name)
    temp_dir = tempfile.gettempdir()
    maya_temp_file = join_path.join_path2(temp_dir, base_name)
    xgen_temp_file = join_path.join_path2(temp_dir, xgen_base_name)
    copy.copy(scene_name, maya_temp_file)
    copy.copy(xgen_path, xgen_temp_file)
    logger.info("Copy to temp: %s" % maya_temp_file)
    # copy local xgen dir to publish.
    xgen_dir = copy_xgen_dir(context)
    logger.info("Copy xgen dir to %s" % xgen_dir)
    # set the path as abs path
    xgen = Xgen()
    xgen.set_abs_path(xgen_dir)
    save_file.save_file()
    logger.info("Set abs path done.")
    # copy to work path
    work_path = context.work_path
    Copy.copy(scene_name, work_path)
    Copy.copy(xgen_path,
              join_path.join_path2(os.path.dirname(work_path), xgen_base_name))
    logger.info("copy maya file and .xgen file to workarea done.")
    # copy from temp file
    copy.copy(maya_temp_file, scene_name)
    copy.copy(xgen_temp_file, xgen_path)
    # delete temp file
    os.remove(maya_temp_file)
    os.remove(xgen_temp_file)
    # open scene name
    open_file.open_file(scene_name)
    logger.info("Reopen %s" % scene_name)
예제 #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 main(file_name, local):
    logger = logging.getLogger("HighRig publish")
    if not local:
        open_file.open_file(file_name)
    # get paths
    context = pipeFile.PathDetails.parse_path(file_name)
    # copy image
    publish.copy_image_and_video(context)
    logger.info("Copy image and video done.")
    # import all reference
    publish.reference_opt()
    logger.info("Import reference done.")
    # delete blends
    delete.delete("_BLENDS")
    # rename shape
    if not rename_pipeline_shape.rename_pipeline_shape():
        raise RuntimeError("Rename shape error.")
    logger.info("Rename shape done.")
    # export needed
    publish.export_need_to_publish(context, "rig")
    logger.info("Export to publish path done.")
    # quit maya
    if not local:
        quit_maya.quit_maya()
예제 #17
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
예제 #18
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")