MLC111: Updater-bearing object is in neither the scene family nor an animation¶
qual reports MLC111 when frames are rendered (a play or
wait) while an object with a registered updater is provably outside the
scene family and not the target of an animation issued by that statement.
Manim only invokes a mobject updater while the mobject is reachable from
the scene or owned by an in-flight animation: an orphaned updater host is
invisible and its callback never runs.
- Default severity:
info - Minimum confidence:
medium(the builtinmin-confidencedefault ishigh, so displaying this rule needsmin-confidence = "medium"or lower) - Implementation phase:
2 - Fix: inserting
self.add(...)before the rendering statement is suggested as an unsafe fix
The rule fires only on definite facts: the registration must happen on
every path, and the object must be provably absent from the scene family
and provably not an animation target of the rendering statement. Maybe
membership (e.g. self.add inside a branch) never violates. Registering
an updater and adding the object (or playing an introducer on it) before
any frame renders is fine.
Wrong¶
class Demo(Scene):
def construct(self):
dot = Dot()
dot.add_updater(lambda m, dt: m.rotate(dt))
self.wait(1) # dot is not in the scene: nothing shows, updater never runs