[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4249] trunk/py/scripts/addons/ io_scene_ms3d: fix: now, using 'object.matrix_basis' instead of 'object. matrix_local' during export for applying transform.

Alexander Nussbaumer alpha-beta-release at gmx.net
Sun Feb 10 00:20:33 CET 2013


Revision: 4249
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4249
Author:   beta-tester
Date:     2013-02-09 23:20:32 +0000 (Sat, 09 Feb 2013)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_ms3d/__init__.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py

Modified: trunk/py/scripts/addons/io_scene_ms3d/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/__init__.py	2013-02-09 13:12:41 UTC (rev 4248)
+++ trunk/py/scripts/addons/io_scene_ms3d/__init__.py	2013-02-09 23:20:32 UTC (rev 4249)
@@ -23,7 +23,7 @@
     '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': "",

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py	2013-02-09 13:12:41 UTC (rev 4248)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py	2013-02-09 23:20:32 UTC (rev 4249)
@@ -263,9 +263,9 @@
 
             # 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 @@
                                 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 @@
                 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 @@
                     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()

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py	2013-02-09 13:12:41 UTC (rev 4248)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py	2013-02-09 23:20:32 UTC (rev 4249)
@@ -62,9 +62,11 @@
                 " ~{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 @@
                 " 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",

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py	2013-02-09 13:12:41 UTC (rev 4248)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py	2013-02-09 23:20:32 UTC (rev 4249)
@@ -492,7 +492,7 @@
             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', }]
     ##

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py	2013-02-09 13:12:41 UTC (rev 4248)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py	2013-02-09 23:20:32 UTC (rev 4249)
@@ -175,8 +175,7 @@
 
 ###############################################################################
 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
 
 



More information about the Bf-extensions-cvs mailing list