File size: 1,347 Bytes
4409449 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import bpy
class Camera:
def __init__(self, *, first_root, mode, is_mesh):
camera = bpy.data.objects['Camera']
## initial position
camera.location.x = 7.36
camera.location.y = -6.93
if is_mesh:
# camera.location.z = 5.45
camera.location.z = 5.6
else:
camera.location.z = 5.2
# wider point of view
if mode == "sequence":
if is_mesh:
camera.data.lens = 65
else:
camera.data.lens = 85
elif mode == "frame":
if is_mesh:
camera.data.lens = 130
else:
camera.data.lens = 85
elif mode == "video":
if is_mesh:
camera.data.lens = 110
else:
# avoid cutting person
camera.data.lens = 85
# camera.data.lens = 140
# camera.location.x += 0.75
self.mode = mode
self.camera = camera
self.camera.location.x += first_root[0]
self.camera.location.y += first_root[1]
self._root = first_root
def update(self, newroot):
delta_root = newroot - self._root
self.camera.location.x += delta_root[0]
self.camera.location.y += delta_root[1]
self._root = newroot
|