[Bf-extensions-cvs] [e742124] master: FBX export: Update to use correctly new Object.matrix_local

Bastien Montagne noreply at git.blender.org
Mon Dec 29 15:38:18 CET 2014


Commit: e74212473cd0fdf9fcf0f50a78a7bf8731d7f4b5
Author: Bastien Montagne
Date:   Mon Dec 29 15:36:08 2014 +0100
Branches: master
https://developer.blender.org/rBAe74212473cd0fdf9fcf0f50a78a7bf8731d7f4b5

FBX export: Update to use correctly new Object.matrix_local

This matrix is finally really local to the parent, no more only to the parent object.

Only working with master rBfb7ff31315a1 and later.

Also, fixed some missing matrix copying...

===================================================================

M	io_scene_fbx/fbx_utils.py

===================================================================

diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 4d5cbe8..fffcc09 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -926,14 +926,14 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
             par_mat_inv = par.matrix_local.inverted_safe() if par else Matrix()
             return par_mat_inv * self.bdata.matrix_local
         else:
-            return self.matrix_local
+            return self.matrix_local.copy()
     matrix_rest_local = property(get_matrix_rest_local)
 
     def get_matrix_rest_global(self):
         if self._tag == 'BO':
             return self._ref.matrix_world * self.bdata.matrix_local
         else:
-            return self.matrix_global
+            return self.matrix_global.copy()
     matrix_rest_global = property(get_matrix_rest_global)
 
     # #### Transform and helpers
@@ -994,19 +994,10 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
             matrix = matrix * MAT_CONVERT_CAMERA
 
         if self._tag in {'DP', 'OB'} and parent:
-            # To get *real* local matrix of a child object, we also need to take into account its inverted par mat!
-            # In fact, this is wrong - since we do not store that matrix in FBX at all, we shall not use it here...
-            #~ matrix = self.bdata.matrix_parent_inverse * matrix
             if parent._tag == 'BO':
-                # In bone parent case, local matrix is in ***armature*** space!!!!!!!!!!!!
-                # So we need to bring it back into parent bone space.
-                matrix = parent._ref.pose.bones[parent.name].matrix.inverted_safe() * matrix
-
                 # In bone parent case, we get transformation in **bone tip** space (sigh).
                 # Have to bring it back into bone root, which is FBX expected value.
-                # Actually, since we parent back to bone space above, we do not need that
-                # correction here it seems...
-                #~ matrix = Matrix.Translation((0, (parent.bdata.tail - parent.bdata.head).length, 0)) * matrix
+                matrix = Matrix.Translation((0, (parent.bdata.tail - parent.bdata.head).length, 0)) * matrix
 
         # Our matrix is in local space, time to bring it in its final desired space.
         if parent:



More information about the Bf-extensions-cvs mailing list