diff --git a/io_scene_psk_psa/psa/config.py b/io_scene_psk_psa/psa/config.py index 3016c59..66864e4 100644 --- a/io_scene_psk_psa/psa/config.py +++ b/io_scene_psk_psa/psa/config.py @@ -14,7 +14,7 @@ class PsaConfig: def _load_config_file(file_path: str) -> ConfigParser: - ''' + """ UEViewer exports a dialect of INI files that is not compatible with Python's ConfigParser. Specifically, it allows values in this format: @@ -24,7 +24,7 @@ def _load_config_file(file_path: str) -> ConfigParser: This is not allowed in Python's ConfigParser, which requires a '=' character after each key name. To work around this, we'll modify the file to add the '=' character after each key name if it is missing. - ''' + """ with open(file_path, 'r') as f: lines = f.read().split('\n') @@ -41,7 +41,7 @@ def _load_config_file(file_path: str) -> ConfigParser: def _get_bone_flags_from_value(value: str) -> int: match value: case 'all': - return (REMOVE_TRACK_LOCATION | REMOVE_TRACK_ROTATION) + return REMOVE_TRACK_LOCATION | REMOVE_TRACK_ROTATION case 'trans': return REMOVE_TRACK_LOCATION case 'rot': diff --git a/io_scene_psk_psa/psa/export/ui.py b/io_scene_psk_psa/psa/export/ui.py index 203b530..1c92337 100644 --- a/io_scene_psk_psa/psa/export/ui.py +++ b/io_scene_psk_psa/psa/export/ui.py @@ -32,7 +32,6 @@ class PSA_UL_export_sequences(UIList): subrow = row.row(align=True) subrow.prop(pg, 'sequence_filter_name', text='') subrow.prop(pg, 'sequence_use_filter_invert', text='', icon='ARROW_LEFTRIGHT') - # subrow.prop(pg, 'sequence_use_filter_sort_reverse', text='', icon='SORT_ASC') if pg.sequence_source == 'ACTIONS': subrow = row.row(align=True) @@ -44,7 +43,6 @@ class PSA_UL_export_sequences(UIList): pg = getattr(context.scene, 'psa_export') actions = getattr(data, prop) flt_flags = filter_sequences(pg, actions) - # flt_neworder = bpy.types.UI_UL_list.sort_items_by_name(actions, 'name') flt_neworder = list(range(len(actions))) return flt_flags, flt_neworder diff --git a/io_scene_psk_psa/psa/importer.py b/io_scene_psk_psa/psa/importer.py index 1a7ea18..cedef80 100644 --- a/io_scene_psk_psa/psa/importer.py +++ b/io_scene_psk_psa/psa/importer.py @@ -64,12 +64,12 @@ class PsaImportResult: def _get_armature_bone_index_for_psa_bone(psa_bone_name: str, armature_bone_names: List[str], bone_mapping_mode: str = 'EXACT') -> Optional[int]: - ''' + """ @param psa_bone_name: The name of the PSA bone. @param armature_bone_names: The names of the bones in the armature. @param bone_mapping_mode: One of 'EXACT' or 'CASE_INSENSITIVE'. @return: The index of the armature bone that corresponds to the given PSA bone, or None if no such bone exists. - ''' + """ for armature_bone_index, armature_bone_name in enumerate(armature_bone_names): if bone_mapping_mode == 'CASE_INSENSITIVE': if armature_bone_name.lower() == psa_bone_name.lower(): diff --git a/io_scene_psk_psa/psa/reader.py b/io_scene_psk_psa/psa/reader.py index 08060b9..bd12dc7 100644 --- a/io_scene_psk_psa/psa/reader.py +++ b/io_scene_psk_psa/psa/reader.py @@ -23,11 +23,11 @@ def _try_fix_cue4parse_issue_103(sequences) -> bool: class PsaReader(object): - ''' + """ This class reads the sequences and bone information immediately upon instantiation and holds onto a file handle. The keyframe data is not read into memory upon instantiation due to its potentially very large size. To read the key data for a particular sequence, call :read_sequence_keys. - ''' + """ def __init__(self, path): self.keys_data_offset: int = 0 @@ -43,11 +43,11 @@ class PsaReader(object): return self.psa.sequences def read_sequence_data_matrix(self, sequence_name: str) -> np.ndarray: - ''' + """ Reads and returns the data matrix for the given sequence. @param sequence_name: The name of the sequence. @return: An FxBx7 matrix where F is the number of frames, B is the number of bones. - ''' + """ sequence = self.psa.sequences[sequence_name] keys = self.read_sequence_keys(sequence_name) bone_count = len(self.bones) @@ -60,12 +60,12 @@ class PsaReader(object): return matrix def read_sequence_keys(self, sequence_name: str) -> List[Psa.Key]: - ''' + """ Reads and returns the key data for a sequence. @param sequence_name: The name of the sequence. @return: A list of Psa.Keys. - ''' + """ # Set the file reader to the beginning of the keys data sequence = self.psa.sequences[sequence_name] data_size = sizeof(Psa.Key) diff --git a/io_scene_psk_psa/psk/export/properties.py b/io_scene_psk_psa/psk/export/properties.py index bdb6493..536ca62 100644 --- a/io_scene_psk_psa/psk/export/properties.py +++ b/io_scene_psk_psa/psk/export/properties.py @@ -3,6 +3,7 @@ from bpy.types import PropertyGroup, Material from ...types import PSX_PG_bone_collection_list_item +empty_set = set() class PSK_PG_material_list_item(PropertyGroup): material: PointerProperty(type=Material) @@ -12,7 +13,7 @@ class PSK_PG_material_list_item(PropertyGroup): class PSK_PG_export(PropertyGroup): bone_filter_mode: EnumProperty( name='Bone Filter', - options=set(), + options=empty_set, description='', items=( ('ALL', 'All', 'All bones will be exported'),