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>2018-02-19 19:27:05 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-02-19 19:27:05 +0300
commitb890f0d7e8a666cb82a908cf9b06c6b500e9e2fc (patch)
tree81453b3fdcb4b365d18abba286a96c270cd8c5d7 /io_scene_fbx/export_fbx_bin.py
parent7e18281d2f1039bf281968427fec45daa79c7531 (diff)
FBX IO: add support for import & export of camera focal length animation.
Requested in T54050, usually would not add new stuff to FBX but this looked like totally needed for compo needs...
Diffstat (limited to 'io_scene_fbx/export_fbx_bin.py')
-rw-r--r--io_scene_fbx/export_fbx_bin.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index d161844f..b75a8977 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1896,8 +1896,9 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
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)
+
+ animdata_shapes = OrderedDict()
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:
@@ -1908,6 +1909,12 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
acnode.add_group(me_key, shape.name, shape.name, (shape.name,))
animdata_shapes[channel_key] = (acnode, me, shape)
+ animdata_cameras = OrderedDict()
+ for cam_obj, cam_key in scene_data.data_cameras.items():
+ cam = cam_obj.bdata.data
+ acnode = AnimationCurveNodeWrapper(cam_key, 'CAMERA_FOCAL', force_key, force_sek, (cam.lens,))
+ animdata_cameras[cam_key] = (acnode, cam)
+
currframe = f_start
while currframe <= f_end:
real_currframe = currframe - f_start if start_zero else currframe
@@ -1927,6 +1934,8 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
ob_obj.dupli_list_clear()
for anim_shape, me, shape in animdata_shapes.values():
anim_shape.add_keyframe(real_currframe, (shape.value * 100.0,))
+ for anim_camera, camera in animdata_cameras.values():
+ anim_camera.add_keyframe(real_currframe, (camera.lens,))
currframe += bake_step
scene.frame_set(back_currframe, 0.0)
@@ -1958,6 +1967,18 @@ def fbx_animations_do(scene_data, ref_id, f_start, f_end, start_zero, objects=No
anim_data = animations[elem_key] = ("dummy_unused_key", OrderedDict())
anim_data[1][fbx_group] = (group_key, group, fbx_gname)
+ # And cameras' lens keys.
+ for cam_key, (anim_camera, camera) in animdata_cameras.items():
+ final_keys = OrderedDict()
+ anim_camera.simplify(simplify_fac, bake_step, force_keep)
+ if not anim_camera:
+ continue
+ for elem_key, group_key, group, fbx_group, fbx_gname in anim_camera.get_final_data(scene, ref_id, force_keep):
+ anim_data = animations.get(elem_key)
+ if anim_data is None:
+ anim_data = animations[elem_key] = ("dummy_unused_key", OrderedDict())
+ anim_data[1][fbx_group] = (group_key, group, fbx_gname)
+
astack_key = get_blender_anim_stack_key(scene, ref_id)
alayer_key = get_blender_anim_layer_key(scene, ref_id)
name = (get_blenderID_name(ref_id) if ref_id else scene.name).encode()