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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-02-17 15:28:28 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-02-17 15:28:28 +0300
commit219e882b3168669bb733dafcce10bb79d90e8002 (patch)
treecae33f5758292eadbe65a35f91470f8f59f798bf /io_scene_fbx
parentda3be8b8f3156c377d3c9de24290583405417803 (diff)
Fix T47457: FBX export: Force full keying in case Simplify factor is set to 0.0
Note that it will export all sampled values - even for actually non-animated channels, not really possible to avoid that without a hell lot more of code, and this rea is convoluted enough right now.
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/export_fbx_bin.py13
-rw-r--r--io_scene_fbx/fbx_utils.py3
2 files changed, 11 insertions, 5 deletions
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 871c198f..a77b74db 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1856,6 +1856,7 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
Generate animation data (a single AnimStack) from objects, for a given frame range.
"""
bake_step = scene_data.settings.bake_anim_step
+ simplify_fac = scene_data.settings.bake_anim_simplify_factor
scene = scene_data.scene
force_keying = scene_data.settings.bake_anim_use_all_bones
force_sek = scene_data.settings.bake_anim_force_startend_keying
@@ -1883,18 +1884,21 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
ACNW = AnimationCurveNodeWrapper
loc, rot, scale, _m, _mr = ob_obj.fbx_object_tx(scene_data)
rot_deg = tuple(convert_rad_to_deg_iter(rot))
- animdata_ob[ob_obj] = (ACNW(ob_obj.key, 'LCL_TRANSLATION', ob_obj.is_bone and force_keying, force_sek, loc),
- ACNW(ob_obj.key, 'LCL_ROTATION', ob_obj.is_bone and force_keying, force_sek, rot_deg),
- ACNW(ob_obj.key, 'LCL_SCALING', ob_obj.is_bone and force_keying, force_sek, scale))
+ force_key = (simplify_fac == 0.0) or (ob_obj.is_bone and force_keying)
+ print(force_key, simplify_fac)
+ animdata_ob[ob_obj] = (ACNW(ob_obj.key, 'LCL_TRANSLATION', force_key, force_sek, loc),
+ ACNW(ob_obj.key, 'LCL_ROTATION', force_key, force_sek, rot_deg),
+ ACNW(ob_obj.key, 'LCL_SCALING', force_key, force_sek, scale))
p_rots[ob_obj] = rot
animdata_shapes = OrderedDict()
+ force_key = (simplify_fac == 0.0)
for me, (me_key, _shapes_key, shapes) in scene_data.data_deformers_shape.items():
# Ignore absolute shape keys for now!
if not me.shape_keys.use_relative:
continue
for shape, (channel_key, geom_key, _shape_verts_co, _shape_verts_idx) in shapes.items():
- acnode = AnimationCurveNodeWrapper(channel_key, 'SHAPE_KEY', False, force_sek, (0.0,))
+ acnode = AnimationCurveNodeWrapper(channel_key, 'SHAPE_KEY', force_key, force_sek, (0.0,))
# Sooooo happy to have to twist again like a mad snake... Yes, we need to write those curves twice. :/
acnode.add_group(me_key, shape.name, shape.name, (shape.name,))
animdata_shapes[channel_key] = (acnode, me, shape)
@@ -1923,7 +1927,6 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
scene.frame_set(back_currframe, 0.0)
animations = OrderedDict()
- simplify_fac = scene_data.settings.bake_anim_simplify_factor
# And now, produce final data (usable by FBX export code)
# Objects-like loc/rot/scale...
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index ee91a1db..53a540ee 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -775,6 +775,9 @@ class AnimationCurveNodeWrapper:
if not self._keys:
return
+ if fac == 0.0:
+ return
+
# So that, with default factor and step values (1), we get:
min_reldiff_fac = fac * 1.0e-3 # min relative value evolution: 0.1% of current 'order of magnitude'.
min_absdiff_fac = 0.1 # A tenth of reldiff...