Ejemplo n.º 1
0
def playblast_shot(submit=True):
    logger = logging.getLogger(__name__)
    valid_camera = get_valid_camera.get_valid_camera()
    if not valid_camera:
        raise Exception("No valid camera found.")
    frame_range = get_frame_range.get_frame_range()
    context = pipeFile.PathDetails.parse_path()
    current_project = context.project
    resolution = Project(current_project).resolution
    percent = Project(current_project).playblast_percent
    set_image_size.set_image_size(*resolution)
    local_video_path = context.local_video_path
    video_path = context.work_video_path
    create_parent_dir.create_parent_dir(local_video_path)
    playblaster.playblaster(local_video_path,
                            valid_camera,
                            frame_range[0],
                            frame_range[1],
                            resolution,
                            percent,
                            open_it=True)
    logger.info("Playblast to %s" % local_video_path)
    # backup video path
    if submit:
        Copy.copy(local_video_path, video_path)
        logger.info("Copy %s >> %s" % (local_video_path, video_path))
        return video_path
    else:
        return local_video_path
Ejemplo n.º 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)
Ejemplo n.º 3
0
def playblast_turntable(submit=True):
    logger = logging.getLogger(__name__)
    # get path
    obj = pipeFile.PathDetails.parse_path()
    local_video_path = obj.local_video_path
    work_video_path = obj.work_video_path
    current_project = obj.project
    # playblast
    model_name = get_model_name.get_model_name()
    resolution = Project(current_project).resolution
    percent = Project(current_project).playblast_percent
    set_image_size.set_image_size(*resolution)
    mc.select(model_name, r=1)
    create_turntable.create_turntable()
    create_parent_dir.create_parent_dir(local_video_path)
    playblaster.playblaster(local_video_path, "tt_camera", 1, 120, resolution,
                            percent, False, None, True)
    remove_turntable.remove_turntable()
    logger.info("playblast done.")
    mc.lookThru("persp")
    if submit:
        Copy.copy(local_video_path, work_video_path)
        logger.info("Copy %s >> %s" % (local_video_path, work_video_path))
        return work_video_path
    else:
        return local_video_path
Ejemplo n.º 4
0
def publish_textures(tex_dir):
    all_textures = get_all_textures()
    all_textures = list(set(all_textures))
    if not all_textures:
        return
    for tex in all_textures:
        base_name = os.path.basename(tex)
        new_path = join_path.join_path2(tex_dir, base_name)
        Copy.copy(tex, new_path)
Ejemplo n.º 5
0
 def do_submit(self):
     files = self.file_list.all_items_text()
     if not files:
         self.close()
         return
     self.progress_bar.show()
     self.progress_bar.setRange(0, len(files))
     for index, f in enumerate(files):
         base_name = os.path.basename(f)
         to_other_path = join_path.join_path2(self.other_dir, base_name)
         Copy.copy(f, to_other_path)
         self.progress_bar.setValue(index + 1)
     self.close()
Ejemplo n.º 6
0
Archivo: Shd.py Proyecto: 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)
Ejemplo n.º 7
0
def main():
    logger = logging.getLogger(__name__)
    # copy to QCPublish path
    context = pipeFile.PathDetails.parse_path()
    work_path = context.work_path
    scene_name = get_scene_name.get_scene_name()
    if Copy.copy(scene_name, work_path):
        logger.info("copy %s >> %s" % (scene_name, work_path))
    else:
        raise RuntimeError("copy to work path error.")
Ejemplo n.º 8
0
 def playblast_lay(self):
     # get sequencer frame range
     # get paths and project settings
     local_video_path = self.obj.local_video_path
     video_path = self.obj.video_path
     start_frame, end_frame = get_frame_range.get_frame_range()
     # playblast to local
     create_parent_dir.create_parent_dir(local_video_path)
     playblaster.playblaster(local_video_path,
                             None,
                             start_frame,
                             end_frame,
                             self.resolution,
                             self.percent,
                             open_it=True,
                             use_sequence_time=False)
     self.logger.info("Playblast to %s" % local_video_path)
     # copy to server
     Copy.copy(local_video_path, video_path)
     self.logger.info("Copy %s >> %s" % (local_video_path, video_path))
Ejemplo n.º 9
0
def back_up_textures(backup_tex_dir, file_path, scene_version=None):
    file_path = file_path.replace("\\", "/")
    logger = logging.getLogger(__name__)
    if not os.path.isfile(file_path):
        logger.warning("%s is not an exist file." % file_path)
        return
    base_name = os.path.basename(file_path)
    backup_file = join_path.join_path2(backup_tex_dir, base_name)
    if not os.path.isfile(backup_file):
        Copy.copy(file_path, backup_file)
        logger.info("backup %s >> %s" % (file_path, backup_file))
    else:
        if not filecmp.cmp(file_path, backup_file):
            base_name = os.path.basename(backup_file)
            version_str = "v" + str(scene_version).zfill(3)
            s_base_name, ext = os.path.splitext(base_name)
            new_base_name = "%s_%s%s" % (s_base_name, version_str, ext)
            new_backup_file = join_path.join_path2(backup_tex_dir,
                                                   new_base_name)
            Copy.copy(file_path, new_backup_file)
            logger.info("backup %s >> %s" % (file_path, new_backup_file))
Ejemplo n.º 10
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)
Ejemplo n.º 11
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)
Ejemplo n.º 12
0
 def playblast_lay_single_shot(self, shot_node):
     camera = mc.listConnections("%s.currentCamera" % shot_node, s=1, d=0)
     if not camera:
         self.logger.error("No camera connect to %s" % shot_node)
         return
     start_frame = mc.getAttr("%s.startFrame" % shot_node)
     end_frame = mc.getAttr("%s.endFrame" % shot_node)
     shot_type, seq, shot = shot_node.split("_")
     video_path = pipeFile.get_task_video_file(seq, shot, "lay",
                                               self.current_project)
     prefix, suffix = os.path.splitdrive(video_path)
     local_video_path = os.path.join(self.local_dir,
                                     suffix).replace("\\", "/")
     playblaster.playblaster(local_video_path,
                             camera[0],
                             start_frame,
                             end_frame,
                             self.resolution,
                             self.percent,
                             open_it=False)
     self.logger.info("Playblast to %s" % local_video_path)
     Copy.copy(local_video_path, video_path)
     self.logger.info("Copy %s >> %s" % (local_video_path, video_path))
Ejemplo n.º 13
0
def my_copy(src, dst, permission=False):
    if permission:
        copy.copy(src, dst)
    else:
        Copy.copy(src, dst)
Ejemplo n.º 14
0
def main():
    message_box = QMessageBox.information(None, "Warming Tip",
                                          "Do you want to publish this task.",
                                          QMessageBox.Yes | QMessageBox.No)
    if message_box.name == "No":
        return
    try:
        context = pipeFile.PathDetails.parse_path()
    except:
        logger.warning("Name Error.")
        return
    # check is local file
    if not context.is_local_file():
        QMessageBox.warning(
            None, "Warning",
            "This file is not a local work file.\n Permission defined.")
        return
    # check if work file
    if not context.is_working_file():
        QMessageBox.warning(None, "Warning", "This file is not a work file.")
        return
    progress_dialog = ProgressDialog(maya_window)
    progress_dialog.show_up()
    # preflight
    progress_dialog.set_text("Preflight checking...")
    result, cg = check_gui.main_for_publish()
    if result:
        cg.close()
        cg.deleteLater()
    else:
        logger.error("Some checks can not be passed.")
        progress_dialog.close()
        return
    progress_dialog.set_value(30)
    # save as next version file
    next_version_file = context.next_version_file
    save_as.save_as(next_version_file)
    logger.info("Save to %s" % next_version_file)
    progress_dialog.set_value(40)
    # get path
    context = pipeFile.PathDetails.parse_path(next_version_file)
    entity_type = context.entity_type
    work_image_path = context.work_image_path
    local_image_path = context.local_image_path
    step = context.step
    other_dir = context.other_dir
    # copy to _other
    od = OtherDialog(other_dir, maya_window)
    od.exec_()
    progress_dialog.set_value(50)
    logger.info("Copy to others")
    # screen shot
    progress_dialog.set_text("Screen shot")
    qcpublish_screen_shot(entity_type, local_image_path)
    Copy.copy(local_image_path, work_image_path)
    logger.info("PreQCPublish successful.")
    progress_dialog.set_value(60)
    # post publish
    progress_dialog.set_text("%s_QCPublish" % step)
    qcpublish(step)
    logger.info("QCPublish successful.")
    progress_dialog.set_value(85)
    # write root task id to database
    progress_dialog.set_text("Add to database.")
    post_qcpublish(context)
    logger.info("PostQCPublish successful.")
    # pop message
    progress_dialog.set_value(100)
    QMessageBox.information(maya_window, "Warming Tip",
                            "QC publish successful.")