Skip to content

MLC126: family child is not a Mobject, or not a VMobject in a VGroup

qual reports MLC126 for two confirmed family violations (DESIGN §3.4):

  1. A child of Mobject.add(...), Group(...), or VGroup(...) whose kind is known not to be a Mobject at all — a numeric / string / boolean literal, an Animation or Scene instance, or an instance of a fully resolved non-Manim class. Mobject.add validates children and raises TypeError.
  2. A child of a vectorized family (VGroup(...) or .add(...) on a VMobject instance) that is known to be a plain Mobject but not a VMobject — for example ImageMobject. Vectorized containers store Bézier point data and reject such children; Group is the heterogeneous container.

  3. Default severity: error

  4. Minimum confidence: high
  5. Implementation phase: 1
  6. Fix: none (Group(...) is suggested in the message)

Unknown child kinds never fire: a value returned by an unresolved function or helper stays silent. Scene.add has different semantics and is not covered by this rule.

Wrong

class Demo(Scene):
    def construct(self):
        image = ImageMobject("photo.png")
        group = VGroup(Square(), image)   # plain Mobject in a VGroup
        group.add(3)                      # literal is not a Mobject
class Demo(Scene):
    def construct(self):
        image = ImageMobject("photo.png")
        mixed = Group(Square(), image)    # Group accepts any Mobject
        vectors = VGroup(Square(), Circle())