X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_camera.py;h=984ec0dafa8ecd3fde4d6859abf5cf1f6241c4ef;hb=0a8e52c548c887e1ed8668c4db4b5b0aacf0ec05;hp=fb45535b199c77f600b8bb43e758570264ffb3ab;hpb=42ae18b7a9dc13a72bf421e564f02829d4bdd5be;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_camera.py b/blender/io_mspgl/export_camera.py index fb45535b..984ec0da 100644 --- a/blender/io_mspgl/export_camera.py +++ b/blender/io_mspgl/export_camera.py @@ -2,23 +2,16 @@ import math import mathutils class CameraExporter: - def export_to_file(self, context, out_fn): - obj = context.active_object - - resource = self.export_camera(obj) - - resource.write_to_file(out_fn) - def export_camera(self, obj): if obj.type!='CAMERA': - raise Exception("Object is not a camera") + raise ValueError("Object is not a camera") from .datafile import Resource, Statement resource = Resource(obj.name+".camera", "camera") - position = obj.matrix_world*mathutils.Vector((0, 0, 0)) + position = obj.matrix_world@mathutils.Vector((0, 0, 0)) resource.statements.append(Statement("position", position[0], position[1], position[2])) - look_dir = obj.matrix_world*mathutils.Vector((0, 0, -1, 0)) + look_dir = obj.matrix_world@mathutils.Vector((0, 0, -1, 0)) resource.statements.append(Statement("look_direction", look_dir[0], look_dir[1], look_dir[2])) resource.statements.append(Statement("up_direction", 0.0, 0.0, 1.0)) resource.statements.append(Statement("field_of_view", obj.data.angle_y*180/math.pi))