uncacheClip method

dynamic uncacheClip(
  1. dynamic clip
)

Implementation

uncacheClip(clip) {
  var actions = _actions,
      clipUuid = clip.uuid,
      actionsByClip = _actionsByClip,
      actionsForClip = actionsByClip[clipUuid];

  if (actionsForClip != null) {
    // note: just calling _removeInactiveAction would mess up the
    // iteration state and also require updating the state we can
    // just throw away

    var actionsToRemove = actionsForClip.knownActions;

    for (var i = 0, n = actionsToRemove.length; i != n; ++i) {
      var action = actionsToRemove[i];

      _deactivateAction(action);

      var cacheIndex = action._cacheIndex,
          lastInactiveAction = actions[actions.length - 1];

      action._cacheIndex = null;
      action._byClipCacheIndex = null;

      lastInactiveAction._cacheIndex = cacheIndex;
      actions[cacheIndex] = lastInactiveAction;
      pop(actions);

      _removeInactiveBindingsForAction(action);
    }

    // delete actionsByClip[ clipUuid ];
    actionsByClip.remove(clipUuid);
  }
}