diff --git a/io_scene_psk_psa/psa/import_/operators.py b/io_scene_psk_psa/psa/import_/operators.py index dad82fa..293b003 100644 --- a/io_scene_psk_psa/psa/import_/operators.py +++ b/io_scene_psk_psa/psa/import_/operators.py @@ -156,6 +156,7 @@ class PSA_OT_import(Operator, ImportHelper): options.bone_mapping_mode = pg.bone_mapping_mode options.fps_source = pg.fps_source options.fps_custom = pg.fps_custom + options.translation_scale = pg.translation_scale if options.should_use_config_file: # Read the PSA config file if it exists. @@ -248,6 +249,11 @@ class PSA_OT_import(Operator, ImportHelper): col.use_property_decorate = False col.prop(pg, 'bone_mapping_mode') + col = advanced_panel.column() + col.use_property_split = True + col.use_property_decorate = False + col.prop(pg, 'translation_scale', text='Translation Scale') + col = advanced_panel.column(heading='Options') col.use_property_split = True col.use_property_decorate = False diff --git a/io_scene_psk_psa/psa/import_/properties.py b/io_scene_psk_psa/psa/import_/properties.py index 665d98f..c3d0408 100644 --- a/io_scene_psk_psa/psa/import_/properties.py +++ b/io_scene_psk_psa/psa/import_/properties.py @@ -103,6 +103,11 @@ class PSA_PG_import(PropertyGroup): soft_max=1.0, step=0.0625, ) + translation_scale: FloatProperty( + name='Translation Scale', + default=1.0, + description='Scale factor for bone translation values. Use this when the scale of the armature does not match the PSA file' + ) def filter_sequences(pg: PSA_PG_import, sequences) -> List[int]: diff --git a/io_scene_psk_psa/psa/importer.py b/io_scene_psk_psa/psa/importer.py index 3d20cb7..0b81dc8 100644 --- a/io_scene_psk_psa/psa/importer.py +++ b/io_scene_psk_psa/psa/importer.py @@ -24,6 +24,7 @@ class PsaImportOptions(object): self.bone_mapping_mode = 'CASE_INSENSITIVE' self.fps_source = 'SEQUENCE' self.fps_custom: float = 30.0 + self.translation_scale: float = 1.0 self.should_use_config_file = True self.psa_config: PsaConfig = PsaConfig() @@ -271,6 +272,10 @@ def import_psa(context: Context, psa_reader: PsaReader, armature_object: Object, # Read the sequence data matrix from the PSA. sequence_data_matrix = psa_reader.read_sequence_data_matrix(sequence_name) + if options.translation_scale != 1.0: + # Scale the translation data. + sequence_data_matrix[:, :, 4:] *= options.translation_scale + # Convert the sequence's data from world-space to local-space. for bone_index, import_bone in enumerate(import_bones): if import_bone is None: