Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-17 13:48:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-17 13:48:49 +0400
commit42edb3867ae07adc8f1df3bb0e8a23ee32303adc (patch)
tree90da00fd32b4a005d5775f51e89f15face5c6a74
parentbb69da741b6ba2b8e68d648f99cf8d370870d203 (diff)
patch [#35395] New feature: Add dynamic attributes to fbx export
with some edits
-rw-r--r--io_scene_fbx/export_fbx.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index 802e7950..85aa1b03 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -199,6 +199,20 @@ def meshNormalizedWeights(ob, me):
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('"', "&quot;")))
+ 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 @@ def save_single(operator, scene, filepath="",
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 @@ def save_single(operator, scene, filepath="",
'\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