def update_exocortex(exocortex_node): path = exocortex_node.fileName.get() latest_version = get_latest_version.get_latest_version(path)[0].replace("\\", "/") if path != latest_version: if os.path.isfile(latest_version): exocortex_node.fileName.set(latest_version) else: logging.warning("%s is not an exist file." % latest_version)
def update_reference(ref_node): path = ref_node.referenceFile().path latest_version = get_latest_version.get_latest_version(path)[0].replace("\\", "/") if path != latest_version: if os.path.isfile(latest_version): rn = pm.system.FileReference(ref_node) rn.replaceWith(latest_version) else: logging.warning("%s is not an exist file." % latest_version) # assign shader to deformed. lgt_assign_shader_deformed.lgt_assign_shader_deformed(ref_node.name())
def auto_solve(self): reference_nodes = self.get_error_list() if not reference_nodes: self.pass_check(u"没有不是最新的reference文件") return for ref_node in reference_nodes: path = ref_node.referenceFile().path latest_version = get_latest_version.get_latest_version(path) if latest_version: rn = pm.system.FileReference(ref_node) rn.replaceWith(latest_version[0]) self.pass_check(u"所有的reference文件已被更新")
def has_update(): references = pm.listReferences() if not references: return for ref in references: ref_path = ref.path.replace("/", "\\") latest_path_versions = get_latest_version.get_latest_version(ref_path) if not latest_path_versions: continue latest_path = latest_path_versions[0] latest_path = latest_path.replace("/", "\\") if ref_path != latest_path: return True
def get_error_list(self): references = pm.listReferences() if not references: self.pass_check("No reference file found.") return not_newest_reference = list() for ref in pm.listReferences(): ref_node = ref.refNode path = ref_node.referenceFile().path latest_version_list = get_latest_version.get_latest_version(path) if not latest_version_list: continue latest_version = latest_version_list[0] if os.path.normpath(path) != os.path.normpath(latest_version): not_newest_reference.append(ref_node) return not_newest_reference
def get_exocortex_model_data(self): model_data = list() exocortex_nodes = pm.ls(type="ExocortexAlembicFile") if exocortex_nodes: for node in exocortex_nodes: item = ReferenceItem() file_name = node.fileName.get() latest_path = get_latest_version.get_latest_version(file_name)[0] latest_path = latest_path.replace("\\", "/") if not file_name == latest_path: item.icon_path = self.red_icon_path else: item.icon_path = self.green_icon_path item.text = node.name() item.path = file_name item.type = "exocortex" model_data.append([item.icon_path, item.text, item.path, item.type, item]) return model_data
def get_reference_model_data(self): model_data = list() references = pm.ls(type="reference") if references: for ref in references: if ref.name() in ["sharedReferenceNode"]: continue item = ReferenceItem() item.type = "reference" ref_path = pm.referenceQuery(ref, filename=1, wcn=1) item.path = ref_path latest_path_list = get_latest_version.get_latest_version(ref_path) if not latest_path_list: continue latest_path = latest_path_list[0] latest_path = latest_path.replace("\\", "/") if not ref_path == latest_path: item.icon_path = self.red_icon_path else: item.icon_path = self.green_icon_path item.text = ref.name() model_data.append([item.icon_path, item.text, item.path, item.type, item]) return model_data
def update_reference(ref_node): path = ref_node.referenceFile().path.replace("/", "\\") latest_version = get_latest_version.get_latest_version(path)[0] if path != latest_version: rn = pm.system.FileReference(ref_node) rn.replaceWith(latest_version)