Skip to content

MLR120: focal_distance camera setter under an OpenGL-target profile

qual reports MLR120 when focal_distance is passed to ThreeDScene.set_camera_orientation or ThreeDScene.move_camera while an active render profile targets the OpenGL renderer.

  • Default severity: warning
  • Minimum confidence: high
  • Implementation phase: 4
  • Fix: none (suggests a renderer guard or Cairo-only profiles)

Only the Cairo ThreeDCamera exposes focal-distance control (ThreeDCamera.set_focal_distance and its value tracker). The OpenGLCamera has no such setter, so under OpenGL set_camera_orientation(focal_distance=...) raises AttributeError, and move_camera(focal_distance=...) emits the runtime warning "focal distance of OpenGLCamera can not be adjusted" and drops the value (three_d_scene.py, opengl_renderer.py).

The rule fires on an explicit focal_distance keyword or its exact positional slot; an explicit None (the documented "leave unchanged" value), **kwargs splats, and runs without an OpenGL profile stay silent. applicable_profiles lists the OpenGL profiles (DESIGN 15.8).

Wrong (with an OpenGL profile active):

self.set_camera_orientation(phi=75 * DEGREES, focal_distance=5)

Right:

self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)