diff --git a/io_scene_ms3d/__init__.py b/io_scene_ms3d/__init__.py index 1d231a113082a2e30a2ff0ed249febf71a1150bf..4f51ef69a079d439e2c58da16963a83e6b6396a6 100644 --- a/io_scene_ms3d/__init__.py +++ b/io_scene_ms3d/__init__.py @@ -23,7 +23,7 @@ bl_info = { 'description': "Import / Export MilkShape3D MS3D files"\ " (conform with MilkShape3D v1.8.4)", 'author': "Alexander Nussbaumer", - 'version': (0, 94, 0), + 'version': (0, 95, 0), 'blender': (2, 65, 3), 'location': "File > Import & File > Export", 'warning': "", diff --git a/io_scene_ms3d/ms3d_export.py b/io_scene_ms3d/ms3d_export.py index b377e3222163d0780e92f9eff67cae109554dade..5f256a8d5d14be22a6f08c5bd0adc25fb2b62ed9 100644 --- a/io_scene_ms3d/ms3d_export.py +++ b/io_scene_ms3d/ms3d_export.py @@ -263,9 +263,9 @@ class Ms3dExporter(): # apply transform if self.options_apply_transform: - matrix_transform = blender_mesh_object_temp.matrix_local + matrix_transform = blender_mesh_object_temp.matrix_basis else: - matrix_transform = Matrix() + matrix_transform = 1 # apply modifiers for modifier in blender_mesh_object_temp.modifiers: @@ -564,6 +564,13 @@ class Ms3dExporter(): blender_modifier.object.animation_data.action blender_nla_tracks = \ blender_modifier.object.animation_data.nla_tracks + + # apply transform + if self.options_apply_transform: + matrix_transform = blender_modifier.object.matrix_basis + else: + matrix_transform = 1 + break if blender_bones is None \ @@ -597,11 +604,11 @@ class Ms3dExporter(): if blender_bone.parent: ms3d_joint.parent_name = blender_bone.parent.name ms3d_joint.__matrix = matrix_difference( - blender_bone.matrix_local, - blender_bone.parent.matrix_local) + matrix_transform * blender_bone.matrix_local, + matrix_transform * blender_bone.parent.matrix_local) else: ms3d_joint.__matrix = base_bone_correction \ - * blender_bone.matrix_local + * matrix_transform * blender_bone.matrix_local mat = ms3d_joint.__matrix loc = mat.to_translation() @@ -675,7 +682,7 @@ class Ms3dExporter(): if blender_pose_bone.parent: m2 = blender_pose_bone.parent.matrix_channel.inverted() else: - m2 = Matrix() + m2 = 1 m3 = blender_pose_bone.matrix.copy() m = ((m1 * m2) * m3) loc = m.to_translation() diff --git a/io_scene_ms3d/ms3d_strings.py b/io_scene_ms3d/ms3d_strings.py index 84a5a5681e75f0da8179805eef8aa45f45952396..995e9268ef1a876a0123c13ba1759ab712ee95d1 100644 --- a/io_scene_ms3d/ms3d_strings.py +++ b/io_scene_ms3d/ms3d_strings.py @@ -62,9 +62,11 @@ ms3d_str = { " ~{1:.4}s, converter: ~{2:.4}s)", 'SUMMARY_EXPORT': "elapsed time: {0:.4}s (converter:"\ " ~{1:.4}s, media io: ~{2:.4}s)", - 'WARNING_EXPORT_SKIP_WEIGHT' : "skipped weight", + 'WARNING_EXPORT_SKIP_WEIGHT' : "skipped weight (ms3d can handle 3 weighs max.,"\ + " the less weighty weight was skipped)", 'WARNING_EXPORT_SKIP_WEIGHT_EX' : "skipped weight:"\ - " limit exceeded", + " limit exceeded (ms3d can handle 3 weighs max., the less weighty"\ + " weights were skipped)", ############################### 'TEXT_OPERATOR': "MilkShape 3D (.ms3d)", @@ -210,15 +212,14 @@ ms3d_str = { " Display | Textured Solid,"\ " View | Clip (0.001 mm ... 1 km)", 'PROP_NAME_NORMALIZE_WEIGHTS' : "Normalize Weights", - 'PROP_DESC_NORMALIZE_WEIGHTS' : "normalize weights to 100%,"\ - " when its sum of weights is greater than 100%", + 'PROP_DESC_NORMALIZE_WEIGHTS' : "normalize all weights to 100%,", 'PROP_NAME_SHRINK_TO_KEYS' : "Shrink To Keys", 'PROP_DESC_SHRINK_TO_KEYS' : "shrinks the animation to region from"\ " first keyframe to last keyframe", 'PROP_NAME_BAKE_EACH_FRAME' : "Bake Each Frame As Key", 'PROP_DESC_BAKE_EACH_FRAME' : "if enabled, to each frame there will be"\ " a key baked", - 'LABEL_NAME_JOINT_TO_BONES' : "works only with some models!", + 'LABEL_NAME_JOINT_TO_BONES' : "use only for bones created in blender", 'PROP_NAME_JOINT_TO_BONES' : "Joints To Bones", 'PROP_DESC_JOINT_TO_BONES' : "changes the length of the bones", 'PROP_NAME_USE_BLENDER_NAMES' : "Use Blender Names Only", diff --git a/io_scene_ms3d/ms3d_ui.py b/io_scene_ms3d/ms3d_ui.py index 31369429634e4db4367f8cf03b9ebd604d2e7738..291d919716a538b0b3c66a3d84edc3b90fff30a6 100644 --- a/io_scene_ms3d/ms3d_ui.py +++ b/io_scene_ms3d/ms3d_ui.py @@ -492,7 +492,7 @@ class Ms3dExportOperator(Operator, ExportHelper): default=ms3d_str['FILE_FILTER'], options={'HIDDEN', } ) - + ##def object_items(self, blender_context): ## return[(item.name, item.name, "") for item in blender_context.selected_objects if item.type in {'MESH', }] ## diff --git a/io_scene_ms3d/ms3d_utils.py b/io_scene_ms3d/ms3d_utils.py index 6617a8da703b6a7c0b1e5b739cd57ec0bb2b70fc..db3623386e602901b229246c28b6598f179c3aee 100644 --- a/io_scene_ms3d/ms3d_utils.py +++ b/io_scene_ms3d/ms3d_utils.py @@ -175,8 +175,7 @@ def rotation_matrix(v_track, v_up): ############################################################################### def matrix_difference(mat_src, mat_dst): - mat_dst_inv = mat_dst.copy() - mat_dst_inv.invert() + mat_dst_inv = mat_dst.inverted() return mat_dst_inv * mat_src