@lovelace_lol/loom3 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -384,6 +384,43 @@ var BakedAnimationController = class {
384
384
  source: this.clipSources.get(clip.name) ?? "baked"
385
385
  }));
386
386
  }
387
+ removeAnimationClip(clipName) {
388
+ const clip = this.animationClips.find((entry) => entry.name === clipName);
389
+ if (!clip || (this.clipSources.get(clipName) ?? "baked") !== "baked") {
390
+ return false;
391
+ }
392
+ const relatedActions = /* @__PURE__ */ new Set();
393
+ const bakedAction = this.animationActions.get(clipName);
394
+ const clipAction = this.clipActions.get(clipName);
395
+ if (bakedAction) relatedActions.add(bakedAction);
396
+ if (clipAction) relatedActions.add(clipAction);
397
+ this.stopAnimation(clipName);
398
+ if (this.animationMixer) {
399
+ for (const action of relatedActions) {
400
+ try {
401
+ this.animationMixer.uncacheAction(clip);
402
+ } catch {
403
+ }
404
+ try {
405
+ this.animationMixer.uncacheClip(clip);
406
+ } catch {
407
+ }
408
+ const actionId = this.getActionId(action);
409
+ if (actionId) {
410
+ this.actionIdToClip.delete(actionId);
411
+ }
412
+ this.actionIds.delete(action);
413
+ }
414
+ }
415
+ this.animationClips = this.animationClips.filter((entry) => entry.name !== clipName);
416
+ this.animationActions.delete(clipName);
417
+ this.clipActions.delete(clipName);
418
+ this.clipHandles.delete(clipName);
419
+ this.animationFinishedCallbacks.delete(clipName);
420
+ this.playbackState.delete(clipName);
421
+ this.clipSources.delete(clipName);
422
+ return true;
423
+ }
387
424
  playAnimation(clipName, options = {}) {
388
425
  const action = this.getOrCreateBakedAction(clipName);
389
426
  if (!action) {
@@ -5053,6 +5090,9 @@ var _Loom3 = class _Loom3 {
5053
5090
  getAnimationClips() {
5054
5091
  return this.bakedAnimations.getAnimationClips();
5055
5092
  }
5093
+ removeAnimationClip(clipName) {
5094
+ return this.bakedAnimations.removeAnimationClip(clipName);
5095
+ }
5056
5096
  playAnimation(clipName, options = {}) {
5057
5097
  return this.bakedAnimations.playAnimation(clipName, options);
5058
5098
  }