syncInstance method

void syncInstance()

Puts the rendered args onto the instance — every declared parameter, so one the motion stopped writing falls back to its default rather than staying wherever the last frame left it.

Implementation

void syncInstance() {
  // Compiled: the builder IS how args reach the child, so the instance is
  // rebuilt from the args of the moment. A parsed child has bindings and
  // takes them the other way, in place.
  if (declared case var d?) {
    instance = d.merge(SceneArgs(renderedArgs)).build().scene;
    return;
  }
  var inst = instance;
  if (inst == null) return;
  inst.applyArgs({
    for (var p in inst.params) p.name: p.defaultValue,
    ...renderedArgs,
  });
}