Пример #1
0
 def __init__(self, parent=None):
     super(CommonForm, self).__init__(parent)
     self.setup_ui()
     self.init()
     self.set_signals()
     self.db = db_api.DbApi(self.project).db_obj
     self.__asset_types = pipeGlobal.Project(self.project).asset_type
Пример #2
0
    def __init__(self, parent=None):
        super(HairUI, self).__init__(parent)
        self.setWindowTitle("Import Hair")
        self.resize(300, 200)

        main_layout = QVBoxLayout(self)
        main_layout.setSpacing(20)

        layout = QGridLayout()
        project_label = QLabel("Project")
        self.project_combo = ProjectCombo()
        asset_type_label = QLabel("Asset Type")
        self.asset_type_combo = CombBox()
        asset_name_label = QLabel("Asset Name")
        self.asset_name_le = QLineEdit()
        namespace_label = QLabel("namespace")
        self.namespace_le = QLineEdit()
        layout.addWidget(project_label, 0, 0, 1, 1)
        layout.addWidget(self.project_combo, 0, 1, 1, 3)
        layout.addWidget(asset_type_label, 1, 0, 1, 1)
        layout.addWidget(self.asset_type_combo, 1, 1, 1, 3)
        layout.addWidget(asset_name_label, 2, 0, 1, 1)
        layout.addWidget(self.asset_name_le, 2, 1, 1, 3)
        layout.addWidget(namespace_label, 3, 0, 1, 1)
        layout.addWidget(self.namespace_le, 3, 1, 1, 3)
        layout.setSpacing(20)
        self.import_btn = QPushButton("Import")

        main_layout.addLayout(layout)
        main_layout.addWidget(self.import_btn)

        self.__db = db_api.DbApi(self.project).db_obj

        self.init()
        self.set_signals()
Пример #3
0
 def set_model(self):
     if not self.project:
         return
     db = db_api.DbApi(self.project).db_obj
     sequences = db.get_all_sequences()
     sequences.sort()
     if not sequences:
         model = QStandardItemModel()
         self.tree_view.setModel(model)
     else:
         root_node = Node("TaskTree", "root")
         for sequence in sequences:
             sequence_node = Node(sequence, "sequence", root_node)
             shots = db.get_all_shots(sequence)
             if not shots:
                 continue
             shots = [shot.get("code") for shot in shots]
             shots.sort()
             for shot in shots:
                 shot_node = Node(shot, "shot", sequence_node)
                 for step in STEPS:
                     step_node = Node(step, "step", shot_node)
         model = TaskTreeModel(root_node)
         self.proxy_model.setSourceModel(model)
         self.tree_view.setModel(self.proxy_model)
         self.tree_view.setSortingEnabled(True)
Пример #4
0
def post_publish(context, change_task_status=False):
    if not os.path.isfile(context.publish_path):
        logger.error("Something wrong with publish")
        return
    # set task publish file
    logger.info("start post publish...")
    db = db_api.DbApi(context.project).db_obj
    current_task = task_from_db_path.task_from_db_path(db, context.work_path)
    logger.info("Current Task: %s" % current_task)
    if os.path.isfile(context.image_path):
        db.upload_thumbnail(current_task, context.image_path)
    db.update_file_path(current_task, publish_file_path=context.publish_path)
    logger.info("update task publish file: %s" % context.publish_path)
    # change task status
    if change_task_status:
        db.update_task_status(current_task, "Delivered")
        logger.info("update task status: Delivered")
    # # for shotgun register publish file
    # self.logger.info("publish path: %s" % self.context.publish_path)
    # try:
    #     tk = toolkit.Toolkit(self.project).tk_obj
    #     self.logger.info("%s" % repr(tk.get_context_from_path(self.context.publish_path)))
    #     tk.publish_file(self.context.publish_path)
    # except RuntimeError as e:
    #     self.logger.error(str(e))
    logger.info("All Done.")
Пример #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
Пример #6
0
    def __init__(self, parent=None):
        super(ShotReview, self).__init__(parent)
        self.resize(800, 730)
        self.setWindowTitle("Shot Review")
        self.setWindowFlags(Qt.Window)
        self.__projects = pipeGlobal.projects
        self.current_project = pipeGlobal.current_project
        self.__db = db_api.DbApi(self.current_project).db_obj
        self.__shot_step = pipeGlobal.Project(self.current_project).shot_steps
        self.play_list = list()

        main_layout = QVBoxLayout(self)
        main_layout.setContentsMargins(0, 0, 0, 0)
        project_layout = QHBoxLayout()
        project_label = QLabel("Project")
        self.project_cbox = QComboBox()
        project_layout.addWidget(project_label)
        project_layout.addWidget(self.project_cbox)
        project_layout.setStretchFactor(project_label, 0)
        project_layout.setStretchFactor(self.project_cbox, 1)

        list_layout = QHBoxLayout()

        self.sequence_group = MyGroup("sequence", "All Sequences", self)
        self.sequence_group.check_box.setEnabled(False)
        self.sequence_group.list_widget.setSelectionMode(QListWidget.SingleSelection)
        self.shot_group = MyGroup("shot", "All Shots", self)
        self.step_group = MyGroup("step", "Latest", self)
        self.step_group.list_widget.setSelectionMode(QListWidget.SingleSelection)

        list_layout.addWidget(self.sequence_group)
        list_layout.addWidget(self.shot_group)
        list_layout.addWidget(self.step_group)

        btn_layout = QHBoxLayout()
        self.add_to_playlist_btn = QPushButton("Add to playlist")
        btn_layout.addStretch()
        btn_layout.addWidget(self.add_to_playlist_btn)

        self.play_list = ListWidget(True, self)

        play_layout = QHBoxLayout()
        self.play_btn = QPushButton("Play")
        play_layout.addStretch()
        play_layout.addWidget(self.play_btn)

        main_layout.addLayout(project_layout)
        main_layout.addLayout(list_layout)
        main_layout.addLayout(btn_layout)
        main_layout.addWidget(self.play_list)
        main_layout.addLayout(play_layout)

        self.init_project()
        self.init_sequence()
        self.set_signals()
        self.set_style()
Пример #7
0
 def on_project_changed(self, project):
     pipeHistory.set("currentProject", project)
     self.db = db_api.DbApi(project).db_obj
     self.asset_check.setChecked(False)
     self.shot_check.setChecked(False)
     for widget in [
             self.first_widget, self.second_widget, self.third_widget,
             self.fourth_widget
     ]:
         widget.list_view.clear()
Пример #8
0
 def __init__(self, parent=None):
     super(Entity, self).__init__(parent)
     self.__init_asset_type()
     self.db = db_api.DbApi(self.project).db_obj
     self.__main_menu = QMenu()
     self.__entity_action_group = QActionGroup(self)
     self.__task_action_group = QActionGroup(self)
     self.__set_signals()
     self.__threads = list()
     self.engine = get_engine.get_engine()
     self.__show_image = False
Пример #9
0
 def __init__(self, parent=None):
     super(TaskGet, self).__init__(parent)
     self.setObjectName("TaskGet")
     self.__logger = logging.getLogger("TaskGet")
     self.__engine = get_engine.get_engine()
     self.__db = db_api.DbApi(self.project).db_obj
     self.init()
     self.set_style()
     self.set_model()
     self.set_signals()
     self.selected = None
Пример #10
0
def post_qcpublish(context):
    from miraLibs.dbLibs import db_api
    from miraLibs.pipeLibs.pipeDb import task_from_db_path
    db = db_api.DbApi(context.project).db_obj
    task = task_from_db_path.task_from_db_path(db, context.work_path)
    if not task:
        logger.warning("No matched task")
        return
    db.update_task_status(task, "Supervisor Review")
    db.upload_thumbnail(task, context.work_image_path)
    # upload version
    db.upload_version(task,
                      media_path=context.work_video_path,
                      file_path=context.work_path)
    logger.info("Upload version done.")
    # update task
    db.update_file_path(task, work_file_path=context.work_path)
    logger.info("Update work file done.")
Пример #11
0
 def post_start(self):
     if not os.path.isfile(self.work_file):
         self.logger.error("Something wrong with start")
         return
     # set task sg_startfile
     self.logger.info("start post start...")
     db = db_api.DbApi(self.project).db_obj
     # register the file path
     current_task = task_from_db_path.task_from_db_path(db, self.work_file)
     if db.typ == "shotgun":
         create_filesystem_structure.create_filesystem_structure(self.work_file, engine="tk-%s" % self.engine)
     self.logger.info("Current Task: %s" % current_task)
     # update sg_workfile
     if db.typ == "shotgun":
         db.update_task(current_task, sg_workfile=self.work_file)
         self.logger.info("update task sg_workfile: %s" % self.work_file)
     # update sg_status_list
     db.update_task_status(current_task, "Ready to Start")
     self.logger.info("update task sg_status_list: Ready to Start")
     self.logger.info("\n\nALL Done!")
Пример #12
0
def import_camera(project, sequence, step):
    db = db_api.DbApi(project).db_obj
    shots = db.get_all_shots(sequence)
    if not shots:
        print "No shot exist in this sequence"
        return
    shot_names = [shot.get("code") for shot in shots]
    for shot_name in shot_names:
        cache_template = Project(project).template("maya_shot_cache")
        cache_dir = cache_template.format(project=project, sequence=sequence,
                                          shot=shot_name.split("_")[-1], step=step, task=step)
        camera_cache_path = "%s/camera.abc" % cache_dir
        camera_cache_path = camera_cache_path.replace("\\", "/")
        if not os.path.isfile(camera_cache_path):
            print "%s is not exist." % camera_cache_path
            continue
        reference_files = mc.file(q=1, r=1, wcn=1)
        if camera_cache_path in reference_files:
            print "%s already exist" % camera_cache_path
            continue
        create_reference.create_reference(camera_cache_path)
    group_camera()
Пример #13
0
 def __init__(self, parent=None):
     super(MyTaskForm, self).__init__(parent)
     self.setup_ui()
     self.db = db_api.DbApi(self.project).db_obj
     self.do_refresh()
     self.set_signals()
Пример #14
0
 def change_project(self, index):
     self.current_project = self.__projects[index]
     self.__db = db_api.DbApi(self.current_project).db_obj
     self.init_sequence()
     self.shot_group.list_widget.clear()
     self.shot_group.check_box.setChecked(False)
Пример #15
0
def get_department_of_user(user_name=None):
    if not user_name:
        user_name = getpass.getuser()
    db = db_api.DbApi().db_obj
    department = db.get_user_department(user_name)
    return department
Пример #16
0
def task_from_path(path):
    context = pipeFile.PathDetails.parse_path(path)
    project = context.project
    db = db_api.DbApi(project).db_obj
    task = task_from_db_path(db, path)
    return task