[Bf-extensions-cvs] [0fadf6c] master: Fix own mistake in recent template commit, also add 'Other' type of geometries export by default.

Bastien Montagne noreply at git.blender.org
Fri Jul 4 15:50:12 CEST 2014


Commit: 0fadf6ce46ea585755caf80b8468d87837688541
Author: Bastien Montagne
Date:   Fri Jul 4 15:49:26 2014 +0200
https://developer.blender.org/rBA0fadf6ce46ea585755caf80b8468d87837688541

Fix own mistake in recent template commit, also add 'Other' type of geometries export by default.

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 86d7ac5..e3cbb22 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -217,7 +217,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
                ('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'},
+        default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH', 'OTHER'},
     )
 
     use_mesh_modifiers = BoolProperty(
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index a7ccc53..c80615a 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -215,8 +215,8 @@ def fbx_template_def_camera(scene, settings, override_defaults=None, nbr_users=0
         (b"UseRealTimeMotionBlur", (True, "p_bool", False)),
         (b"Motion Blur Intensity", (1.0, "p_number", True)),
         (b"AspectRatioMode", (0, "p_enum", False)),  # WindowSize.
-        (b"AspectWidth", (320, "p_double", False)),
-        (b"AspectHeight", (200, "p_double", False)),
+        (b"AspectWidth", (320.0, "p_double", False)),
+        (b"AspectHeight", (200.0, "p_double", False)),
         (b"PixelAspectRatio", (1.0, "p_double", False)),
         (b"FilmOffsetX", (0.0, "p_number", True)),
         (b"FilmOffsetY", (0.0, "p_number", True)),
@@ -621,10 +621,11 @@ def fbx_data_camera_elements(root, cam_obj, scene_data):
     elem_props_template_set(tmpl, props, "p_color", b"BackgroundColor", (0.0, 0.0, 0.0))
     elem_props_template_set(tmpl, props, "p_bool", b"DisplayTurnTableIcon", True)
 
-    elem_props_template_set(tmpl, props, "p_double", b"AspectRatioMode", 1)  # FixedRatio
-    elem_props_template_set(tmpl, props, "p_double", b"AspectWidth", float(r.resolution_x))
-    elem_props_template_set(tmpl, props, "p_double", b"AspectHeight", float(r.resolution_y))
-    elem_props_template_set(tmpl, props, "p_double", b"PixelAspectRatio", float(r.pixel_aspect_x / r.pixel_aspect_y))
+    elem_props_template_set(tmpl, props, "p_double", b"AspectRatioMode", 1.0)  # FixedRatio
+    elem_props_template_set(tmpl, props, "p_double", b"AspectWidth", float(render.resolution_x))
+    elem_props_template_set(tmpl, props, "p_double", b"AspectHeight", float(render.resolution_y))
+    elem_props_template_set(tmpl, props, "p_double", b"PixelAspectRatio",
+                            float(render.pixel_aspect_x / render.pixel_aspect_y))
 
     elem_props_template_set(tmpl, props, "p_double", b"FilmWidth", filmwidth)
     elem_props_template_set(tmpl, props, "p_double", b"FilmHeight", filmheight)
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 76496bf..5ee70fe 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -578,7 +578,11 @@ def fbx_templates_generate(root, fbx_templates):
             elem = elem_data_single_string(template, b"PropertyTemplate", prop_type_name)
             props = elem_properties(elem)
             for name, (value, ptype, animatable) in properties.items():
-                elem_props_set(props, ptype, name, value, animatable=animatable)
+                try:
+                    elem_props_set(props, ptype, name, value, animatable=animatable)
+                except Exception as e:
+                    print("Failed to write template prop (%r)" % e)
+                    print(props, ptype, name, value, animatable)
 
 
 ##### FBX objects generators. #####



More information about the Bf-extensions-cvs mailing list