[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4535] tags/2_67a_release/py/scripts/ addons/io_scene_fbx/export_fbx.py: patch [#35395] New feature: Add dynamic attributes to fbx export
Campbell Barton
ideasman42 at gmail.com
Fri May 17 11:48:49 CEST 2013
Revision: 4535
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4535
Author: campbellbarton
Date: 2013-05-17 09:48:49 +0000 (Fri, 17 May 2013)
Log Message:
-----------
patch [#35395] New feature: Add dynamic attributes to fbx export
with some edits
Modified Paths:
--------------
tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py
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-16 21:56:43 UTC (rev 4534)
+++ tags/2_67a_release/py/scripts/addons/io_scene_fbx/export_fbx.py 2013-05-17 09:48:49 UTC (rev 4535)
@@ -199,6 +199,20 @@
return groupNames, vWeightList
+
+def save_custom_properties(fw, ob, ident):
+ for (key, value) in ob.items():
+ value_type = type(value)
+ if value_type == str:
+ fw('%sProperty: "%s", "KString", "U","%s"' % (ident, key, value.replace('"', """)))
+ elif value_type == int:
+ fw('%sProperty: "%s", "int", "U",%i' % (ident, key, value))
+ elif value_type == float:
+ fw('%sProperty: "%s", "double", "U",%.15f' % (ident, key, value))
+ # elif value_type == bool:
+ # fw('%sProperty: "%s", "bool", "U",%i' % (ident, key, int(value)))
+
+
header_comment = \
'''; FBX 6.1.0 project file
; Created by Blender FBX Exporter
@@ -225,6 +239,7 @@
use_mesh_edges=True,
use_rotate_workaround=False,
use_default_take=True,
+ use_custom_properties=True,
):
import bpy_extras.io_utils
@@ -675,6 +690,13 @@
'\n\t\t\tProperty: "Look", "enum", "",1'
)
+ if use_custom_properties:
+ # object and bone are fine
+ if ob:
+ save_custom_properties(fw, ob, "\n\t\t\t")
+ elif pose_bone:
+ save_custom_properties(fw, pose_bone, "\n\t\t\t")
+
return loc, rot, scale, matrix, matrix_rot
# -------------------------------------------- Armatures
More information about the Bf-extensions-cvs
mailing list