fix camera always exported even when unchecked
parent
09eca87060
commit
adbb813410
|
@ -36,7 +36,7 @@ def Export_AE_2d_position_json_data():
|
||||||
pix_pos = Vector((pos[0]*rx, (1-pos[1])*ry))
|
pix_pos = Vector((pos[0]*rx, (1-pos[1])*ry))
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def export_ae_transforms(directory, selection=None, camera=None, exposition=True, prefix='ae_', suffix='', fr=False, export_format='txt'):
|
def export_ae_transforms(directory, selection=None, camera=None, exposition=True, prefix='ae_', suffix='', fr=False, export_format='txt', export_cam=True):
|
||||||
"""
|
"""
|
||||||
Export After Effects transform data for selected objects and camera in Blender.
|
Export After Effects transform data for selected objects and camera in Blender.
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ def export_ae_transforms(directory, selection=None, camera=None, exposition=True
|
||||||
"comp_pixel_aspect_ratio": 1,
|
"comp_pixel_aspect_ratio": 1,
|
||||||
'objects': objs_keyframe_data
|
'objects': objs_keyframe_data
|
||||||
}
|
}
|
||||||
if camera is not None:
|
if export_cam: #camera is not None:
|
||||||
keyframe_data['camera'] = cam_key_frame_data
|
keyframe_data['camera'] = cam_key_frame_data
|
||||||
|
|
||||||
Path(directory, f'{prefix}keyframe_data{suffix}.json').write_text(json.dumps(keyframe_data, indent=4), encoding='utf-8')
|
Path(directory, f'{prefix}keyframe_data{suffix}.json').write_text(json.dumps(keyframe_data, indent=4), encoding='utf-8')
|
||||||
|
@ -192,7 +192,7 @@ def export_ae_transforms(directory, selection=None, camera=None, exposition=True
|
||||||
keyframe_data_txt = get_keyframe_data_txt(keyframe_data, exposition=exposition)
|
keyframe_data_txt = get_keyframe_data_txt(keyframe_data, exposition=exposition)
|
||||||
Path(directory, f'{prefix}{name}{suffix}.txt').write_text(keyframe_data_txt, newline='\r\n')
|
Path(directory, f'{prefix}{name}{suffix}.txt').write_text(keyframe_data_txt, newline='\r\n')
|
||||||
|
|
||||||
if camera is not None:
|
if export_cam: #camera is not None:
|
||||||
keyframe_data_txt = get_keyframe_data_txt(cam_key_frame_data, exposition=False)
|
keyframe_data_txt = get_keyframe_data_txt(cam_key_frame_data, exposition=False)
|
||||||
Path(directory, f'{prefix}{camera.name}{suffix}.txt').write_text(keyframe_data_txt, newline='\r\n')
|
Path(directory, f'{prefix}{camera.name}{suffix}.txt').write_text(keyframe_data_txt, newline='\r\n')
|
||||||
|
|
||||||
|
@ -313,11 +313,11 @@ class GPEXP_OT_export_anim_to_ae(bpy.types.Operator, ExportHelper):
|
||||||
print('Output directory: ', output_path)
|
print('Output directory: ', output_path)
|
||||||
|
|
||||||
cam = None
|
cam = None
|
||||||
if self.use_active_camera and context.scene.camera:
|
if context.scene.camera:
|
||||||
cam = context.scene.camera
|
cam = context.scene.camera
|
||||||
|
|
||||||
if cam and cam in objects_selection:
|
if cam and cam in objects_selection:
|
||||||
## Remove active camera from objects
|
## Remove active camera from objects list
|
||||||
objects_selection.pop(objects_selection.index(cam))
|
objects_selection.pop(objects_selection.index(cam))
|
||||||
|
|
||||||
print('Export AE transform from objects:')
|
print('Export AE transform from objects:')
|
||||||
|
@ -330,7 +330,8 @@ class GPEXP_OT_export_anim_to_ae(bpy.types.Operator, ExportHelper):
|
||||||
exposition=self.exposition,
|
exposition=self.exposition,
|
||||||
prefix='ae_',
|
prefix='ae_',
|
||||||
fr=self.data_lang == 'FR',
|
fr=self.data_lang == 'FR',
|
||||||
export_format=self.file_format)
|
export_format=self.file_format,
|
||||||
|
export_cam=self.use_active_camera)
|
||||||
|
|
||||||
self.report({'INFO'}, f'File(s) saved in folder: {output_path}')
|
self.report({'INFO'}, f'File(s) saved in folder: {output_path}')
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
Loading…
Reference in New Issue