Skip to content

Commit

Permalink
Update camera.py to allow for dynamic change of lens parameter during…
Browse files Browse the repository at this point in the history
… job
  • Loading branch information
aelmiger committed Jun 5, 2024
1 parent c7944e0 commit da5a42d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion syclops/blender/sensors/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,22 @@ def render_outputs(self):
cam.data.dof.focus_distance,
)

if "lens_type" in self.config:
lens_type = utility.eval_param(self.config["lens_type"])
else:
lens_type = "PERSPECTIVE"

# Set camera settings
cam.data.lens = utility.eval_param(self.config["focal_length"])
cam.data.sensor_width = utility.eval_param(self.config["sensor_width"])
if lens_type == "PERSPECTIVE":
cam.data.lens = utility.eval_param(self.config["focal_length"])
elif lens_type == "FISHEYE_EQUIDISTANT":
cam.data.cycles.fisheye_fov = utility.eval_param(self.config["fisheye_fov"])
elif lens_type == "FISHEYE_EQUISOLID":
cam.data.cycles.fisheye_lens = utility.eval_param(self.config["focal_length"])
cam.data.cycles.fisheye_fov = utility.eval_param(self.config["fisheye_fov"])
else:
raise ValueError("Camera: not supported lens type \"%s\"", lens_type)

if "motion_blur" in self.config:
if self.config["motion_blur"]["enabled"]:
Expand Down

0 comments on commit da5a42d

Please sign in to comment.