diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-17 13:56:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-17 13:56:43 +0400 |
commit | 53681fce681116150926fed98d8f2b4650f9216f (patch) | |
tree | da506c378697aa916255e8bea82c5dc5d83dbd72 | |
parent | 42edb3867ae07adc8f1df3bb0e8a23ee32303adc (diff) |
remove XNA workarounds - XNA is not being further developed.
-rw-r--r-- | io_scene_fbx/__init__.py | 58 | ||||
-rw-r--r-- | io_scene_fbx/export_fbx.py | 36 |
2 files changed, 4 insertions, 90 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 19de4803..ce2142aa 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -128,8 +128,6 @@ class ExportFBX(bpy.types.Operator, ExportHelper): use_mesh_edges = BoolProperty( name="Include Edges", - description=("Edges may not be necessary, can cause import " - "pipeline errors with XNA"), default=False, ) use_armature_deform_only = BoolProperty( @@ -169,16 +167,6 @@ class ExportFBX(bpy.types.Operator, ExportHelper): default=6.0, ) path_mode = path_reference_mode - use_rotate_workaround = BoolProperty( - name="XNA Rotate Animation Hack", - description="Disable global rotation, for XNA compatibility", - default=False, - ) - xna_validate = BoolProperty( - name="XNA Strict Options", - description="Make sure options are compatible with Microsoft XNA", - default=False, - ) batch_mode = EnumProperty( name="Batch Mode", items=(('OFF', "Off", "Active scene to file"), @@ -197,46 +185,10 @@ class ExportFBX(bpy.types.Operator, ExportHelper): options={'HIDDEN'}, ) - # Validate that the options are compatible with XNA (JCB) - def _validate_xna_options(self): - if not self.xna_validate: - return False - changed = False - if not self.use_rotate_workaround: - changed = True - self.use_rotate_workaround = True - if self.global_scale != 1.0: - changed = True - self.global_scale = 1.0 - if self.mesh_smooth_type != 'OFF': - changed = True - self.mesh_smooth_type = 'OFF' - if self.use_anim_optimize: - changed = True - self.use_anim_optimize = False - if self.use_mesh_edges: - changed = True - self.use_mesh_edges = False - if self.use_default_take: - changed = True - self.use_default_take = False - if self.object_types & {'CAMERA', 'LAMP', 'EMPTY'}: - changed = True - self.object_types -= {'CAMERA', 'LAMP', 'EMPTY'} - if self.path_mode != 'STRIP': - changed = True - self.path_mode = 'STRIP' - return changed - @property def check_extension(self): return self.batch_mode == 'OFF' - def check(self, context): - is_def_change = super().check(context) - is_xna_change = self._validate_xna_options() - return (is_xna_change or is_def_change) - def execute(self, context): from mathutils import Matrix if not self.filepath: @@ -248,18 +200,16 @@ class ExportFBX(bpy.types.Operator, ExportHelper): global_matrix[1][1] = \ global_matrix[2][2] = self.global_scale - if not self.use_rotate_workaround: - global_matrix = (global_matrix * - axis_conversion(to_forward=self.axis_forward, - to_up=self.axis_up, - ).to_4x4()) + global_matrix = (global_matrix * + axis_conversion(to_forward=self.axis_forward, + to_up=self.axis_up, + ).to_4x4()) keywords = self.as_keywords(ignore=("axis_forward", "axis_up", "global_scale", "check_existing", "filter_glob", - "xna_validate", )) keywords["global_matrix"] = global_matrix diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index 85aa1b03..730a0aea 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -237,7 +237,6 @@ def save_single(operator, scene, filepath="", use_metadata=True, path_mode='AUTO', use_mesh_edges=True, - use_rotate_workaround=False, use_default_take=True, use_custom_properties=True, ): @@ -248,10 +247,6 @@ def save_single(operator, scene, filepath="", mtx_x90 = Matrix.Rotation(math.pi / 2.0, 3, 'X') # Used for mesh and armature rotations mtx4_z90 = Matrix.Rotation(math.pi / 2.0, 4, 'Z') - # Rotation does not work for XNA animations. I do not know why but they end up a mess! (JCB) - if use_rotate_workaround: - # Set rotation to Matrix Identity for XNA (JCB) - mtx4_z90.identity() if global_matrix is None: global_matrix = Matrix() @@ -500,10 +495,6 @@ def save_single(operator, scene, filepath="", rot = tuple(rot.to_euler()) # quat -> euler scale = tuple(scale) - # Essential for XNA to use the original matrix not rotated nor scaled (JCB) - if use_rotate_workaround: - matrix = ob.matrix_local - else: # This is bad because we need the parent relative matrix from the fbx parent (if we have one), dont use anymore #if ob and not matrix: matrix = ob.matrix_world * global_matrix @@ -3068,30 +3059,3 @@ def save(operator, context, # bpy.data.scenes.active = orig_sce return {'FINISHED'} # so the script wont run after we have batch exported. - -# APPLICATION REQUIREMENTS -# Please update the lists for UDK, Unity, XNA etc. on the following web page: -# http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Import-Export/UnifiedFBX - -# XNA FBX Requirements (JCB 29 July 2011) -# - Armature must be parented to the scene -# - Armature must be a 'Limb' never a 'null'. This is in several places. -# - First bone must be parented to the armature. -# - Rotation must be completely disabled including -# always returning the original matrix in In object_tx(). -# It is the animation that gets distorted during rotation! -# - Lone edges cause intermittent errors in the XNA content pipeline! -# I have added a warning message and excluded them. -# - Bind pose must be included with the 'MESH' -# Typical settings for XNA export -# No Cameras, No Lamps, No Edges, No face smoothing, No Default_Take, Armature as bone, Disable rotation - -# NOTE TO Campbell - -# Can any or all of the following notes be removed because some have been here for a long time? (JCB 27 July 2011) -# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts) -# - get rid of bpy.path.clean_name somehow -# + get rid of BPyObject_getObjectArmature, move it in RNA? -# - implement all BPyMesh_* used here with RNA -# - getDerivedObjects is not fully replicated with .dupli* funcs -# - don't know what those colbits are, do we need them? they're said to be deprecated in DNA_object_types.h: 1886-1893 -# - no hq normals: 1900-1901 |