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);
  }
}