def replace_event(self, event_obj): new_event_name = event_obj['name'].replace(self.__oldName, self.__newName).replace( '_01', '') WaapiTools.rename_object(event_obj, new_event_name) for action in WaapiTools.get_children_objects(event_obj, False): target = WaapiTools.get_object_property(action, '@Target') target_full = WaapiTools.get_full_info_from_obj_id(target['id']) new_target_path = target_full['path'].replace( self.__oldName, self.__newName) new_target = WaapiTools.get_object_from_path(new_target_path) if new_target is not None: WaapiTools.set_object_reference(action, 'Target', new_target)
def add_file(self, file, asset_type): row = self.tblFileList.rowCount() self.tblFileList.setRowCount(row + 1) file_guid = file.rstrip('.asset') obj = WaapiTools.get_full_info_from_obj_id('{' + file_guid + '}') if obj is not None: obj_name = obj['name'] status = '正常' else: full_path = os.path.join(self.__workDir, asset_type, file) with open(full_path) as text: obj_name = text.readlines()[13].lstrip( ' objectName: ').rstrip() status = '多余' self.tblFileList.setItem(row, 0, QTableWidgetItem(obj_name)) self.tblFileList.setItem(row, 1, QTableWidgetItem(asset_type)) self.tblFileList.setItem(row, 2, QTableWidgetItem(status)) self.tblFileList.setItem(row, 3, QTableWidgetItem(file_guid))
def replace_bank(self, bank_obj): new_bank_name = bank_obj['name'].replace(self.__oldName, self.__newName).replace( '_01', '') WaapiTools.rename_object(bank_obj, new_bank_name) new_inclusion_objects = [] for old_inclusion_obj in SoundBankTools.get_bank_inclusions(bank_obj): target_full = WaapiTools.get_full_info_from_obj_id( old_inclusion_obj['object']) new_target_path = target_full['path'].replace( self.__oldName, self.__newName) new_target = WaapiTools.get_object_from_path(new_target_path) if new_target is not None: inclusion = { 'object': new_target['id'], 'filter': old_inclusion_obj['filter'] } new_inclusion_objects.append(inclusion) SoundBankTools.clear_bank_inclusions(bank_obj) SoundBankTools.add_objects_to_bank_with_individual_inclusion( bank_obj, new_inclusion_objects)