[Bf-extensions-cvs] [f948f65] master: After Effects export: Fix T86504: Camera position offset bug

Damien Picard noreply at git.blender.org
Wed Mar 17 20:43:39 CET 2021


Commit: f948f658ba33eb670a65e0bba058d43138abea7e
Author: Damien Picard
Date:   Wed Mar 17 18:12:45 2021 +0100
Branches: master
https://developer.blender.org/rBACf948f658ba33eb670a65e0bba058d43138abea7e

After Effects export: Fix T86504: Camera position offset bug

During implementation of D9556, the transformations for the objects
were changed to accomodate new object types. This rendered the new
exported files incompatible with old ones.

This commit brings back compatibility while still allowing export of
images and solids.

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

M	io_export_after_effects.py

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

diff --git a/io_export_after_effects.py b/io_export_after_effects.py
index 7aec1d1..e39f1e5 100644
--- a/io_export_after_effects.py
+++ b/io_export_after_effects.py
@@ -23,7 +23,7 @@ bl_info = {
     "description": "Export cameras, selected objects & camera solution "
         "3D Markers to Adobe After Effects CS3 and above",
     "author": "Bartek Skorupa",
-    "version": (0, 0, 67),
+    "version": (0, 0, 68),
     "blender": (2, 80, 0),
     "location": "File > Export > Adobe After Effects (.jsx)",
     "warning": "",
@@ -301,7 +301,7 @@ def convert_transform_matrix(matrix, width, height, aspect,
     scale_mat = Matrix.Scale(width, 4)
 
     # Get blender transform data for ob
-    b_loc = (scale_mat @ matrix).to_translation()
+    b_loc = matrix.to_translation()
     b_rot = matrix.to_euler('ZYX')  # ZYX euler matches AE's orientation and allows to use x_rot_correction
     b_scale = matrix.to_scale()
 
@@ -309,9 +309,9 @@ def convert_transform_matrix(matrix, width, height, aspect,
     # AE's X is Blender's X,
     # AE's Y is Blender's -Z,
     # AE's Z is Blender's Y
-    x = (b_loc.x * ae_size / 100.0) / aspect + width / 2.0
-    y = (-b_loc.z * ae_size / 100.0) + (height / 2.0)
-    z = (b_loc.y * ae_size / 100.0)
+    x = (b_loc.x * 100.0 / aspect + width / 2.0) * ae_size / 100.0
+    y = (-b_loc.z * 100.0 + height / 2.0) * ae_size / 100.0
+    z = (b_loc.y * 100.0) * ae_size / 100.0
 
     # Convert rotations to match AE's orientation.
     # If not x_rot_correction
@@ -684,6 +684,8 @@ def write_jsx_file(file, data, selection, include_animation,
                 name_ae = convert_name(obj.name)
                 # Convert obj transform properties to AE space
                 plane_matrix = get_plane_matrix(obj)
+                # Scale plane to account for AE's transforms
+                plane_matrix = plane_matrix @ Matrix.Scale(100.0 / data['width'], 4)
                 ae_transform = convert_transform_matrix(
                     plane_matrix, data['width'], data['height'],
                     data['aspect'], True, ae_size)
@@ -814,6 +816,8 @@ def write_jsx_file(file, data, selection, include_animation,
                 name_ae = convert_name(obj.name)
                 # Convert obj transform properties to AE space
                 plane_matrix = get_image_plane_matrix(obj)
+                # Scale plane to account for AE's transforms
+                plane_matrix = plane_matrix @ Matrix.Scale(100.0 / data['width'], 4)
                 ae_transform = convert_transform_matrix(
                     plane_matrix, data['width'], data['height'],
                     data['aspect'], True, ae_size)



More information about the Bf-extensions-cvs mailing list