Beispiel #1
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)
    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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
0
def save_file():
    engine = get_engine.get_engine()
    if engine == "maya":
        from miraLibs.mayaLibs import save_file
    elif engine == "nuke":
        from miraLibs.nukeLibs import save_file
    else:
        return
    save_file.save_file()
Beispiel #5
0
def create_shot_ad(context):
    ad_path = context.definition_path
    if os.path.isfile(ad_path):
        return
    ad_node_name = "%s_%s_AD" % (context.sequence, context.shot)
    if not os.path.isfile(context.publish_path):
        logger.error("%s is not an exist file" % context.publish_path)
        return
    new_file.new_file()
    rename_scene.rename_scene(ad_path)
    assemb = Assembly.Assembly()
    name = context.step
    node = assemb.create_assembly_node(ad_node_name, "assemblyDefinition")
    assemb.create_representation(node, "Scene", name, name, context.publish_path)
    save_file.save_file()
Beispiel #6
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)
Beispiel #7
0
 def do_publish(self):
     scene_name = get_scene_name.get_scene_name()
     save_file.save_file()
     context = pipeFile.PathDetails.parse_path(scene_name)
     if context.step not in ["MidRig", "HighRig", "HairRig"]:
         mw = MessageWidget("Warning", "This step is not Rig step",
                            PARENT_WIN)
         mw.show()
         return
     # save image to image path
     pixmap = self.thumbnail_widget._get_thumbnail()
     if not pixmap:
         mw = MessageWidget("Warning", "Screen shot first!", PARENT_WIN)
         mw.show()
         return
     image_dir = os.path.dirname(context.image_path)
     if not os.path.isdir(image_dir):
         os.makedirs(image_dir)
     pixmap.save(context.image_path)
     # auto_publish
     auto_publish(context, self.set_final)
     self.close()
     mw = MessageWidget("Success", "Auto Publish done.", PARENT_WIN)
     mw.show()