rebind method

void rebind(
  1. Node newTarget, {
  2. Animation? animation,
})

Re-resolves this clip's channel bindings against newTarget (matching nodes by name), keeping all playback state (playbackTime, weight, playing, etc.). Pass animation to swap in a reloaded version of the same animation (e.g. edited curves from a hot-reloaded model); the playback head is clamped to the new end time.

Used by model hot reload after a subtree is swapped in place; the channel targets resolve by name, so they re-attach to the new nodes.

Implementation

void rebind(Node newTarget, {Animation? animation}) {
  if (animation != null) {
    _animation = animation;
    _playbackTime = clampDouble(_playbackTime, 0, _animation.endTime);
  }
  _bindToTarget(newTarget);
}