[Bf-extensions-cvs] [0f72f6c] master: After Effects export: fix crash when trying to export some meshes
Damien Picard
noreply at git.blender.org
Fri Jan 6 16:30:31 CET 2023
Commit: 0f72f6c85c3743a9072273acb6a8a34b1cf1064b
Author: Damien Picard
Date: Fri Jan 6 16:16:35 2023 +0100
Branches: master
https://developer.blender.org/rBAC0f72f6c85c3743a9072273acb6a8a34b1cf1064b
After Effects export: fix crash when trying to export some meshes
If a mesh consisted in a single rectangle but it wasn't properly
unwrapped (with each vert at a corner), the object was identified as
an image, but could then not be exported as one.
Consider such objects as nulls instead.
===================================================================
M io_export_after_effects.py
===================================================================
diff --git a/io_export_after_effects.py b/io_export_after_effects.py
index 40c208d..0db40e8 100644
--- a/io_export_after_effects.py
+++ b/io_export_after_effects.py
@@ -21,7 +21,7 @@ bl_info = {
"description": "Export cameras, selected objects & camera solution "
"3D Markers to Adobe After Effects CS3 and above",
"author": "Bartek Skorupa, Damien Picard (@pioverfour)",
- "version": (0, 1, 2),
+ "version": (0, 1, 3),
"blender": (2, 80, 0),
"location": "File > Export > Adobe After Effects (.jsx)",
"warning": "",
@@ -444,6 +444,7 @@ def is_image_plane(obj):
- The mesh is a plane
- The mesh has exactly one material
- There is only one image in this material node tree
+ - The rectangle is UV unwrapped and its UV is occupying the whole space
"""
if not is_plane(obj):
return False
@@ -459,9 +460,13 @@ def is_image_plane(obj):
if img is None:
return False
- if len(obj.data.vertices) == 4:
- return True
+ if len(obj.data.vertices) != 4:
+ return False
+
+ if not get_image_plane_matrix(obj):
+ return False
+ return True
def get_image_filepath(obj):
mat = get_first_material(obj)
@@ -499,6 +504,7 @@ def get_image_plane_matrix(obj):
This will only work if uvs occupy all space, to get bounds
"""
+ p0, px, py = None, None, None
for p_i, p in enumerate(obj.data.uv_layers.active.data):
if p.uv == Vector((0, 0)):
p0 = p_i
@@ -507,6 +513,9 @@ def get_image_plane_matrix(obj):
elif p.uv == Vector((0, 1)):
py = p_i
+ if None in (p0, px, py):
+ return False
+
verts = obj.data.vertices
loops = obj.data.loops
More information about the Bf-extensions-cvs
mailing list