Skip to content

MLR111: Scene updater mutates a mobject (Cairo moving scope)

qual reports MLR111 when a Scene.add_updater callback's body contains a call that resolves to a curated visual mutator (shift, rotate, set_color, ...) on a known mobject instance, while a Cairo profile is active.

  • Default severity: warning
  • Minimum confidence: high
  • Implementation phase: 4
  • Fix: none (suggests moving to a Mobject updater)

Scene.add_updater itself warns about exactly this (scene.py): under Cairo, mobjects modified only by a scene updater are not detected by Scene.get_moving_mobjects, so the static/moving partition may bake them into the cached static background and the mutation might not be redrawn every frame. A Mobject updater (mob.add_updater(...)) marks its host as moving and is redrawn reliably.

The rule fires only on all-paths registrations whose callback body is resolvable (a lambda or a top-level function) and provably calls a curated mobject mutator. Unresolvable callbacks, non-mutating bodies, and OpenGL-only runs stay silent; applicable_profiles lists the Cairo profiles (DESIGN 15.8).

Wrong:

self.add_updater(lambda dt: dot.shift(RIGHT * dt))

Right:

dot.add_updater(lambda mob, dt: mob.shift(RIGHT * dt))