diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-29 17:36:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-29 17:36:08 +0300 |
commit | e74212473cd0fdf9fcf0f50a78a7bf8731d7f4b5 (patch) | |
tree | 42f6322d705261e0c5bffd6a83cedd8ac6f172c6 | |
parent | 51d535f652d93bbdfc7e69e6b5ed46e0d1c597f9 (diff) |
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...
-rw-r--r-- | io_scene_fbx/fbx_utils.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py index 4d5cbe8e..fffcc098 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: |