[Bf-extensions-cvs] [0edbcbc] master: FBX IO: Add an 'experimental' addon, to test new fixes and features.

Bastien Montagne noreply at git.blender.org
Mon Sep 8 15:02:03 CEST 2014


Commit: 0edbcbca6cd31bdb2b58c35d4abc1b5ee39ea9ab
Author: Bastien Montagne
Date:   Mon Sep 8 12:52:20 2014 +0200
Branches: master
https://developer.blender.org/rBA0edbcbca6cd31bdb2b58c35d4abc1b5ee39ea9ab

FBX IO: Add an 'experimental' addon, to test new fixes and features.

For now, mere copy of 'main' addon...

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

A	io_scene_fbx_experimental/__init__.py
A	io_scene_fbx_experimental/cycles_shader_compat.py
A	io_scene_fbx_experimental/data_types.py
A	io_scene_fbx_experimental/encode_bin.py
A	io_scene_fbx_experimental/export_fbx.py
A	io_scene_fbx_experimental/export_fbx_bin.py
A	io_scene_fbx_experimental/fbx2json.py
A	io_scene_fbx_experimental/fbx_utils.py
A	io_scene_fbx_experimental/import_fbx.py
A	io_scene_fbx_experimental/json2fbx.py
A	io_scene_fbx_experimental/parse_fbx.py

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

diff --git a/io_scene_fbx_experimental/__init__.py b/io_scene_fbx_experimental/__init__.py
new file mode 100644
index 0000000..efa88e3
--- /dev/null
+++ b/io_scene_fbx_experimental/__init__.py
@@ -0,0 +1,467 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+bl_info = {
+    "name": "EXPERIMENTAL FBX format",
+    "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
+    "version": (3, 2, 0),
+    "blender": (2, 72, 0),
+    "location": "File > Import-Export",
+    "description": "Experimental FBX io meshes, UV's, vertex colors, materials, "
+                   "textures, cameras, lamps and actions",
+    "warning": "Use at own risks! This addon is to test new fixes and features, *not* for every-day FBX io "
+               "(unless you know what you are doing)",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+                "Scripts/Import-Export/Autodesk_FBX",
+    "category": "Import-Export",
+}
+
+
+if "bpy" in locals():
+    import importlib
+    if "import_fbx" in locals():
+        importlib.reload(import_fbx)
+    if "export_fbx_bin" in locals():
+        importlib.reload(export_fbx_bin)
+    if "export_fbx" in locals():
+        importlib.reload(export_fbx)
+
+
+import bpy
+from bpy.props import (StringProperty,
+                       BoolProperty,
+                       FloatProperty,
+                       EnumProperty,
+                       )
+
+from bpy_extras.io_utils import (ImportHelper,
+                                 ExportHelper,
+                                 path_reference_mode,
+                                 axis_conversion,
+                                 )
+
+
+class ImportFBX_experimental(bpy.types.Operator, ImportHelper):
+    """Load a FBX geometry file"""
+    bl_idname = "import_scene.fbx_experimental"
+    bl_label = "Import FBX - Experimental"
+    bl_options = {'UNDO', 'PRESET'}
+
+    directory = StringProperty()
+
+    filename_ext = ".fbx"
+    filter_glob = StringProperty(default="*.fbx", options={'HIDDEN'})
+
+    use_manual_orientation = BoolProperty(
+            name="Manual Orientation",
+            description="Specify orientation and scale, instead of using embedded data in FBX file",
+            default=False,
+            )
+    axis_forward = EnumProperty(
+            name="Forward",
+            items=(('X', "X Forward", ""),
+                   ('Y', "Y Forward", ""),
+                   ('Z', "Z Forward", ""),
+                   ('-X', "-X Forward", ""),
+                   ('-Y', "-Y Forward", ""),
+                   ('-Z', "-Z Forward", ""),
+                   ),
+            default='-Z',
+            )
+    axis_up = EnumProperty(
+            name="Up",
+            items=(('X', "X Up", ""),
+                   ('Y', "Y Up", ""),
+                   ('Z', "Z Up", ""),
+                   ('-X', "-X Up", ""),
+                   ('-Y', "-Y Up", ""),
+                   ('-Z', "-Z Up", ""),
+                   ),
+            default='Y',
+            )
+    global_scale = FloatProperty(
+            name="Scale",
+            min=0.001, max=1000.0,
+            default=1.0,
+            )
+
+    use_image_search = BoolProperty(
+            name="Image Search",
+            description="Search subdirs for any associated images (Warning, may be slow)",
+            default=True,
+            )
+
+    use_alpha_decals = BoolProperty(
+            name="Alpha Decals",
+            description="Treat materials with alpha as decals (no shadow casting)",
+            default=False,
+            options={'HIDDEN'}
+            )
+    decal_offset = FloatProperty(
+            name="Decal Offset",
+            description="Displace geometry of alpha meshes",
+            min=0.0, max=1.0,
+            default=0.0,
+            options={'HIDDEN'}
+            )
+
+    use_custom_props = BoolProperty(
+            name="Import user properties",
+            description="Import user properties as custom properties",
+            default=True,
+            options={'HIDDEN'},
+            )
+    use_custom_props_enum_as_string = BoolProperty(
+            name="Import enum properties as string",
+            description="Store enumeration values as string",
+            default=True,
+            options={'HIDDEN'},
+            )
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.prop(self, "use_manual_orientation"),
+        sub = layout.column()
+        sub.enabled = self.use_manual_orientation
+        sub.prop(self, "axis_forward")
+        sub.prop(self, "axis_up")
+        sub.prop(self, "global_scale")
+
+        layout.prop(self, "use_image_search")
+        # layout.prop(self, "use_alpha_decals")
+        layout.prop(self, "decal_offset")
+
+        layout.prop(self, "use_custom_props")
+        sub = layout.row()
+        sub.enabled = self.use_custom_props
+        sub.prop(self, "use_custom_props_enum_as_string")
+
+    def execute(self, context):
+        print("Using EXPERIMENTAL FBX export!")
+        keywords = self.as_keywords(ignore=("filter_glob", "directory"))
+        keywords["use_cycles"] = (context.scene.render.engine == 'CYCLES')
+
+        from . import import_fbx
+        return import_fbx.load(self, context, **keywords)
+
+
+class ExportFBX_experimental(bpy.types.Operator, ExportHelper):
+    """Selection to an ASCII Autodesk FBX"""
+    bl_idname = "export_scene.fbx_experimental"
+    bl_label = "Export FBX - Experimental"
+    bl_options = {'UNDO', 'PRESET'}
+
+    filename_ext = ".fbx"
+    filter_glob = StringProperty(default="*.fbx", options={'HIDDEN'})
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+
+    version = EnumProperty(
+            items=(('BIN7400', "FBX 7.4 binary", "Newer 7.4 binary version, still in development (no animation yet)"),
+                   ('ASCII6100', "FBX 6.1 ASCII", "Legacy 6.1 ascii version"),
+                   ),
+            name="Version",
+            description="Choose which version of the exporter to use",
+            )
+
+    use_selection = BoolProperty(
+            name="Selected Objects",
+            description="Export selected objects on visible layers",
+            default=False,
+            )
+    global_scale = FloatProperty(
+            name="Scale",
+            description="Scale all data (Some importers do not support scaled armatures!)",
+            min=0.001, max=1000.0,
+            soft_min=0.01, soft_max=1000.0,
+            default=1.0,
+            )
+    axis_forward = EnumProperty(
+            name="Forward",
+            items=(('X', "X Forward", ""),
+                   ('Y', "Y Forward", ""),
+                   ('Z', "Z Forward", ""),
+                   ('-X', "-X Forward", ""),
+                   ('-Y', "-Y Forward", ""),
+                   ('-Z', "-Z Forward", ""),
+                   ),
+            default='-Z',
+            )
+    axis_up = EnumProperty(
+            name="Up",
+            items=(('X', "X Up", ""),
+                   ('Y', "Y Up", ""),
+                   ('Z', "Z Up", ""),
+                   ('-X', "-X Up", ""),
+                   ('-Y', "-Y Up", ""),
+                   ('-Z', "-Z Up", ""),
+                   ),
+            default='Y',
+            )
+    # 7.4 only
+    bake_space_transform = BoolProperty(
+            name="Apply Transform",
+            description=("Bake space transform into object data, avoids getting unwanted rotations to objects when "
+                         "target space is not aligned with Blender's space "
+                         "(WARNING! experimental option, might give odd/wrong results)"),
+            default=False,
+            )
+
+    object_types = EnumProperty(
+            name="Object Types",
+            options={'ENUM_FLAG'},
+            items=(('EMPTY', "Empty", ""),
+                   ('CAMERA', "Camera", ""),
+                   ('LAMP', "Lamp", ""),
+                   ('ARMATURE', "Armature", ""),
+                   ('MESH', "Mesh", ""),
+                   ('OTHER', "Other", "Other geometry types, like curve, metaball, etc. (converted to meshes)"),
+                   ),
+            description="Which kind of object to export",
+            default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH', 'OTHER'},
+            )
+
+    use_mesh_modifiers = BoolProperty(
+            name="Apply Modifiers",
+            description="Apply modifiers to mesh objects (except Armature ones!)",
+            default=True,
+            )
+    mesh_smooth_type = EnumProperty(
+            name="Smoothing",
+            items=(('OFF', "Off", "Don't write smoothing, export normals instead"),
+                   ('FACE', "Face", "Write face smoothing"),
+                   ('EDGE', "Edge", "Write edge smoothing"),
+                   ),
+            description=("Export smoothing information "
+                         "(prefer 'Off' option if your target importer understand split normals)"),
+            default='OFF',
+            )
+    use_mesh_edges = BoolProperty(
+            name="Loose Edges",
+            description="Export loose edges (as two-vertices polygons)",
+            default=False,
+            )
+    # 7.4 only
+    use_tspace = BoolProperty(
+            name="Tangent Space",
+            description=("Add binormal and tangent vectors, together with norm

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list