Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander N <alpha-beta-release@gmx.net>2013-02-10 03:20:32 +0400
committerAlexander N <alpha-beta-release@gmx.net>2013-02-10 03:20:32 +0400
commit110da24b010ce2f56f30dce60adadc103903c4bf (patch)
treec118f0dbdbdbc519e3f2d1412583fd9660707a0c
parentbb428363a66f4442b00b555d2d6f408e18d20100 (diff)
fix: now, using 'object.matrix_basis' instead of 'object.matrix_local' during export for applying transform.
that will calculate parented object correctly. related to issue reported by Shadoh. http://www.blender.org/forum/viewtopic.php?t=26251
-rw-r--r--io_scene_ms3d/__init__.py2
-rw-r--r--io_scene_ms3d/ms3d_export.py19
-rw-r--r--io_scene_ms3d/ms3d_strings.py11
-rw-r--r--io_scene_ms3d/ms3d_ui.py2
-rw-r--r--io_scene_ms3d/ms3d_utils.py3
5 files changed, 22 insertions, 15 deletions
diff --git a/io_scene_ms3d/__init__.py b/io_scene_ms3d/__init__.py
index 1d231a11..4f51ef69 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 b377e322..5f256a8d 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 84a5a568..995e9268 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 31369429..291d9197 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 6617a8da..db362338 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