def get_path(ref_file, get_type="image"): context = pipeFile.PathDetails.parse_path(ref_file) if not context: return project_name = context.project entity_type = context.entity_type asset_type = context.asset_type asset_name = context.asset_name current_step = context.step if current_step == "HighRig": step = "MidRig" task = "MidRig" if context.task == "HighRig" else context.task else: step = "HighRig" task = "HighRig" if context.task == "MidRig" else context.task if get_type == "image": path = pipeFile.get_task_file(project_name, asset_type, asset_name, step, task, "maya_asset_image", version="") else: path = pipeFile.get_task_publish_file(project_name, entity_type, asset_type, asset_name, step, task) return path
def main(file_name, local): logger = logging.getLogger("Lookdev start") new_file.new_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 # reference in Shd shd_publish_file = pipeFile.get_task_publish_file(project, entity_type, asset_type, asset_name, "Shd", "Shd") if not os.path.isfile(shd_publish_file): logger.info("%s is not an exist file" % shd_publish_file) return create_reference.create_reference(shd_publish_file, asset_name) logger.info("reference shd done.") # import hair load_plugin.load_plugin("xgenToolkit.mll") mel.eval("XgCreateDescriptionEditor;") publish_file = pipeFile.get_task_file(project, asset_type, asset_name, "Hair", "Hair", "maya_asset_publish", "") context = pipeFile.PathDetails.parse_path(publish_file) import_xgen_hair(context, "hair") logger.info("import hair done.") # reference turn table reference_turntable() logger.info("reference turntable done.") save_as.save_as(file_name) logger.info("%s publish successful!" % file_name) if not local: quit_maya.quit_maya()
def rebuild_asset(context): asset_info_file = pipeFile.get_task_file(context.project, context.sequence, context.shot, "Anim", "Anim", "maya_shot_assetInfo", "") if not os.path.isfile(asset_info_file): log.warning("%s is not an exist file." % asset_info_file) return asset_info_list = json_operation.get_json_data(asset_info_file) if not asset_info_list: log.warning("No data in the json file %s." % asset_info_file) return cache_dir = get_anim_cache_dir(context) for asset_info in asset_info_list: asset_type = asset_info.get("type") asset_name = asset_info.get("name") namespace = asset_info.get("namespace") # project, entity_type, asset_type_sequence, asset_name_shot, step, task, version="", engine="maya" asset_shd_file = pipeFile.get_task_publish_file( context.project, "Asset", asset_type, asset_name, "Shd", "Shd") if os.path.isfile(asset_shd_file): create_reference.create_reference(asset_shd_file, namespace, True) log.info("Reference in %s" % asset_shd_file) cache_file = "%s/%s" % (cache_dir, "%s.abc" % namespace) if os.path.isfile(cache_file): log.info("attaching...") try: import_exocortex_abc.import_exocortex_abc(cache_file) except: log.error("Can't attach %s." % cache_file) else: log.warning("Cache: %s is not an exist file" % cache_file) else: log.warning("Shd: %s is not an exist file")
def do_import(self): load_plugin.load_plugin("xgenToolkit.mll") mel.eval("XgCreateDescriptionEditor;") publish_file = pipeFile.get_task_file(self.project, self.asset_type, self.asset_name, "Hair", "Hair", "maya_asset_publish", "") context = pipeFile.PathDetails.parse_path(publish_file) import_xgen_hair(context, str(self.namespace))
def import_lights(context): light_file = pipeFile.get_task_file(context.project, context.sequence, "c000", "MainLgt", "MainLgt", "maya_shot_light", "") if os.path.isfile(light_file): maya_import.maya_import(light_file) else: create_group.create_group("Lights")
def get_anim_edit_data(): context = pipeFile.PathDetails.parse_path() if context.step == "LgtLay": description_path = pipeFile.get_task_file(context.project, context.sequence, context.shot, "AnimLay", "AnimLay", "maya_shot_description", "") elif context.step == "Lgt": description_path = pipeFile.get_task_file(context.project, context.sequence, context.shot, "Anim", "Anim", "maya_shot_description", "") if os.path.isfile(description_path): cp = conf_parser.ConfParser(description_path) conf_data = cp.parse().get() return conf_data else: print "%s is not an exist file." % description_path
def get_shd_edit_data(context): description_path = pipeFile.get_task_file(context.project, context.sequence, "c000", "MainLgt", "MainLgt", "maya_shot_description", "") if os.path.isfile(description_path): cp = conf_parser.ConfParser(description_path) conf_data = cp.parse().get() return conf_data else: print "%s is not an exist file" % description_path
def reference_in_env(context): set_ad_path = pipeFile.get_task_file(context.project, context.sequence, "c000", "Set", "Set", "maya_shot_definition", "") if not os.path.isfile(set_ad_path): print "%s is not an exist file" % set_ad_path return assemb = Assembly.Assembly() node_name = "%s_%s_set" % (context.sequence, "c000") node = assemb.reference_ad(node_name, set_ad_path) create_group.create_group("Env") mc.parent(node, "Env") return node
def show_tasks(self, index): asset_name_shot = index.data(Qt.ToolTipRole) entity_type = self.entity_ui.entity_type asset_type_sequence = self.entity_ui.asset_type_sequence steps = self.__db.get_step(entity_type, asset_type_sequence, asset_name_shot) steps = list(set(steps)) if "Art" in steps: steps.remove("Art") steps.sort() if not steps: self.task_ui.close_delegate() self.task_ui.set_model([]) self.task_ui.waiting_widget.hide() return model_data = list() ui_text = "<font face=Arial size=4 color=#00b4ff><b>%s - %s - %s</b></font>" \ % (entity_type, asset_type_sequence, asset_name_shot) for step in steps: engine = Step(self.project, step).engine tasks = self.__db.get_task(entity_type, asset_type_sequence, asset_name_shot, step) if not tasks: continue for task in tasks: task_name = task.get("code") status_name = task.get("status").get("name") status_color = task.get("status").get("color") if entity_type == "Asset": format_str = "%s_asset_image" % engine else: format_str = "%s_shot_image" % engine image_path = pipeFile.get_task_file(self.project, asset_type_sequence, asset_name_shot, step, task_name, format_str, "") if not os.path.isfile(image_path): image_path = "%s/%s" % (pipeGlobal.icons_dir, "unknown.png") pix_map = QPixmap(image_path) pix_map = pix_map.scaled(100, 75, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) actions = self.__actions.get(entity_type) task_actions = actions.get("task").get("actions") item = TaskItem(self.project, entity_type, asset_type_sequence, asset_name_shot, step, task_name, pix_map, task_actions, status_name, status_color) model_data.append(item) self.task_ui.set_label(ui_text) self.task_ui.set_model(model_data) self.task_ui.set_delegate()
def main(file_name, local): logger = logging.getLogger("MainLgt start") new_file.new_file() create_group.create_group("Lights") # AR set AD file context = pipeFile.PathDetails.parse_path(file_name) project = context.project sequence = context.sequence set_ad_file = pipeFile.get_task_file(project, sequence, "c000", "Set", "Set", "maya_shot_definition", "") assemb = Assembly.Assembly() node = assemb.reference_ad("%s_c000_set" % sequence, set_ad_file) create_group.create_group("Env") mc.parent(node, "Env") # set Shd active assemb.set_active("Shd") save_as.save_as(file_name) logger.info("%s publish successful!" % file_name) if not local: quit_maya.quit_maya()
def on_export(self): cache_dir = pipeFile.get_task_file(self.project, self.sequence, self.shot, self.step, self.task, "maya_shot_cache") camera_cache_path = "%s/camera.abc" % cache_dir if not os.path.isfile(camera_cache_path): QMessageBox.critical(None, "Warming Tip", u"没有摄像机的.abc缓存文件") return frame_range = self.db.get_shot_task_frame_range( "%s_%s" % (self.sequence, self.shot)) if not frame_range: QMessageBox.critical(None, "Warming Tip", u"strack上没有设置该镜头的帧范围") return start, end = [int(i) for i in frame_range.split("-")] py_path = os.path.abspath( os.path.join(__file__, "..", "export_in_maya.py")) py_path = py_path.replace("\\", "/") mayabatch = Project(self.project).mayabatch_path cmd = "\"%s\" -command \"python \\\"file_name='%s';start=%s;end=%s;execfile('%s')\\\"\"" % ( mayabatch, camera_cache_path, start, end, py_path) print cmd subprocess.Popen(cmd, shell=True) QMessageBox.information(None, "Warming Tip", u"开始导出,稍后会将路径弹出。")