]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mspgl/export_camera.py
Remove outdated includes
[libs/gl.git] / blender / io_mspgl / export_camera.py
1 import math
2 import mathutils
3
4 class CameraExporter:
5         def export_camera(self, obj):
6                 if obj.type!='CAMERA':
7                         raise ValueError("Object {} is not a camera".format(obj.name))
8
9                 from .datafile import Resource, Statement
10                 resource = Resource(obj.name+".camera", "camera")
11
12                 position = obj.matrix_world@mathutils.Vector((0, 0, 0))
13                 resource.statements.append(Statement("position", position[0], position[1], position[2]))
14                 look_dir = obj.matrix_world@mathutils.Vector((0, 0, -1, 0))
15                 resource.statements.append(Statement("look_direction", look_dir[0], look_dir[1], look_dir[2]))
16                 resource.statements.append(Statement("up_direction", 0.0, 0.0, 1.0))
17                 resource.statements.append(Statement("field_of_view", obj.data.angle_y*180/math.pi))
18                 resource.statements.append(Statement("depth_clip", obj.data.clip_start, obj.data.clip_end))
19
20                 return resource