Skip to content

Commit 7d72445

Browse files
Blender tools - EFix xport Tracks from Blender v3.4+
Blender decided to change their API for MovieTrackingCamera. `bpy.types.MovieTrackingCamera.principal` was changed to `bpy.types.MovieTrackingCamera.principal_point`. This change will work with both Blender 3.3 and 3.4+. GitHub issue #282.
1 parent 1058c3f commit 7d72445

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

share/blender/mmSolver_blender_addon/uvtrack_format_blender.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,18 @@ def get_camera_data(context, clip, cam, frame_range):
121121
film_back_width *= 0.1
122122
film_back_height *= 0.1
123123

124-
principal_x = (cam.principal[0] / res_width) - 0.5
125-
principal_y = (cam.principal[0] / res_width) - 0.5
124+
if hasattr(cam, 'principal_point'):
125+
# Blender 3.6+ and newer.
126+
principal_x = (cam.principal_point[0] / res_width) - 0.5
127+
principal_y = (cam.principal_point[1] / res_height) - 0.5
128+
elif hasattr(cam, 'principal'):
129+
# Blender 3.3 and earlier.
130+
principal_x = (cam.principal[0] / res_width) - 0.5
131+
principal_y = (cam.principal[1] / res_height) - 0.5
132+
else:
133+
principal_x = 0.0
134+
principal_y = 0.0
135+
126136
lco_x = principal_x * film_back_width
127137
lco_y = principal_y * film_back_height
128138

0 commit comments

Comments
 (0)