[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4536] tags/2_67a_release/py/scripts/ addons/io_scene_fbx: remove XNA workarounds - XNA is not being further developed.

Campbell Barton ideasman42 at gmail.com
Fri May 17 11:56:43 CEST 2013


Revision: 4536
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4536
Author:   campbellbarton
Date:     2013-05-17 09:56:43 +0000 (Fri, 17 May 2013)
Log Message:
-----------
remove XNA workarounds - XNA is not being further developed.

Modified Paths:
--------------
    tags/2_67a_release/py/scripts/addons/io_scene_fbx/__init__.py
    tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py

Modified: tags/2_67a_release/py/scripts/addons/io_scene_fbx/__init__.py
===================================================================
--- tags/2_67a_release/py/scripts/addons/io_scene_fbx/__init__.py	2013-05-17 09:48:49 UTC (rev 4535)
+++ tags/2_67a_release/py/scripts/addons/io_scene_fbx/__init__.py	2013-05-17 09:56:43 UTC (rev 4536)
@@ -128,8 +128,6 @@
 
     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 @@
             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 @@
             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 @@
         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

Modified: tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-05-17 09:48:49 UTC (rev 4535)
+++ tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py	2013-05-17 09:56:43 UTC (rev 4536)
@@ -237,7 +237,6 @@
         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 @@
     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 @@
             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 @@
         # 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



More information about the Bf-extensions-cvs mailing list