INNER CODE UNIT · Python
z
VITA-Group/Diffusion4D · rendering/blender.py:160
x, y, z = -scale, 0, 0
elif i == 2:
x, y, z = 0, scale, 0
elif i == 3:
x, y, z = 0, -scale, 0
elif i == 4:
x, y, z = 0, 0, scale
elif i == 5:
x, y, z = 0, 0, -scale
else:
raise ValueError(f"Invalid index: i={i}, must be int in range [0, 5].")
camera = bpy.data.objects["Camera"]
camera.location = Vector(np.array([x, y, z]))
direction = -camera.location
rot_quat = direction.to_track_quat("-Z", "Y")
camera.rotation_euler = rot_quat.to_euler()
return camera