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)
    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 #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)
    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 #3
0
def main():
    scene_name = get_scene_name.get_scene_name()
    cwd = os.path.dirname(scene_name)
    if cwd:
        os.startfile(cwd)
    else:
        logging.warning("No file opened.")
Beispiel #4
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 #5
0
def upload_movie(description):
    logger = logging.getLogger(__name__)
    # get scene name
    scene_name = get_scene_name.get_scene_name()
    if not scene_name:
        QMessageBox.warning(None, "Warning", "Save scene first")
        return
    context = pipeFile.PathDetails.parse_path(scene_name)
    next_edition_file = context.next_edition_file
    save_as.save_as(next_edition_file)
    context = pipeFile.PathDetails.parse_path(next_edition_file)
    project = context.project
    entity_type = context.entity_type
    step = context.step
    task = context.task
    if entity_type == "Asset":
        asset_type_or_sequence = context.asset_type
        asset_or_shot = context.asset_name
        local_video_path = playblast_turntable.playblast_turntable(
            submit=False)
    else:
        asset_type_or_sequence = context.sequence
        asset_or_shot = context.shot
        local_video_path = playblast_shot.playblast_shot(submit=False)
    logger.info("Playblast done")
    if local_video_path and os.path.isfile(local_video_path):
        # save_as.save_as(next_version_file)
        db = db_api.DbApi(project).db_obj
        # entity_type, asset_type_or_sequence, asset_or_shot, step, task_name
        current_task = db.get_current_task(entity_type, asset_type_or_sequence,
                                           asset_or_shot, step, task)
        logger.info("Current Task: %s" % current_task)
        if not current_task:
            logger.warning("Task is None")
            return
        if db.typ == "shotgun":
            project_info = db.get_project_by_name()
            user = db.get_current_user()
            code = os.path.splitext(os.path.basename(local_video_path))[0]
            data = {
                'project': project_info,
                'code': code,
                'description': description,
                'sg_status_list': 'rev',
                'entity': current_task["entity"],
                'sg_task': current_task,
                'user': user
            }
            result = db.create('Version', data)
            db.upload("Version", result["id"], local_video_path,
                      "sg_uploaded_movie")
            return True
        elif db.typ == "strack":
            db.upload_version(current_task, local_video_path,
                              next_edition_file)
            return True
    else:
        logger.warning("May playblast wrong.")
        return False
Beispiel #6
0
 def do_publish(self, index):
     asset_name = self.data_model.index(index.row(), 0).data()
     scene_name = get_scene_name.get_scene_name()
     try:
         export_model_abc.export_model_abc(scene_name, False, asset_name)
         QMessageBox.information(self, "Warming Tip", "Export abc done.")
     except Exception as e:
         print str(e)
         QMessageBox.critical(self, "Error Info", "Export abc fail.")
Beispiel #7
0
def main():
    logger = logging.getLogger(__name__)
    # copy to QCPublish path
    obj = pipeFile.PathDetails.parse_path()
    work_path = obj.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.")
Beispiel #8
0
def get_valid_camera(file_path=None):
    if not file_path:
        file_path = get_scene_name.get_scene_name()
    context = pipeFile.PathDetails.parse_path(file_path)
    seq_name = context.sequence
    shot_name = context.shot
    valid_camera = "cam_%s_%s" % (seq_name, shot_name)
    cameras = get_all_cameras.get_all_camera_transforms()
    valid_cameras = [
        camera for camera in cameras if camera.endswith(valid_camera)
    ]
    if len(valid_cameras) != 1:
        return
    else:
        return valid_cameras[0]
Beispiel #9
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 #10
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()