@mml-io/3d-web-client-core 0.0.0-experimental-a3e15a8-20240207 → 0.0.0-experimental-248ff6a-20240207

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.
@@ -1,3 +1,4 @@
1
+ import { type MMLCharacterDescription } from "@mml-io/3d-web-avatar";
1
2
  import { AnimationAction, AnimationMixer, Bone, Object3D } from "three";
2
3
  import { AnimationConfig, CharacterDescription } from "./Character";
3
4
  import { CharacterMaterial } from "./CharacterMaterial";
@@ -13,6 +14,7 @@ export declare class CharacterModel {
13
14
  animations: Record<string, AnimationAction>;
14
15
  animationMixer: AnimationMixer | null;
15
16
  currentAnimation: AnimationState;
17
+ mmlCharacterDescription: MMLCharacterDescription;
16
18
  constructor(characterDescription: CharacterDescription, animationConfig: AnimationConfig, characterModelLoader: CharacterModelLoader);
17
19
  init(): Promise<void>;
18
20
  private applyCustomMaterial;
package/build/index.js CHANGED
@@ -262,7 +262,7 @@ import { Color as Color3, Group, Vector3 as Vector34 } from "three";
262
262
 
263
263
  // src/character/CharacterModel.ts
264
264
  import {
265
- Character as MMLCharacter,
265
+ MMLCharacter,
266
266
  ModelLoader,
267
267
  parseMMLDescription
268
268
  } from "@mml-io/3d-web-avatar";
@@ -706,7 +706,7 @@ var CharacterModel = class {
706
706
  this.animationMixer = new AnimationMixer(this.mesh);
707
707
  }
708
708
  async composeMMLCharacter(mmlCharacterDescription) {
709
- var _a, _b, _c;
709
+ var _a, _b;
710
710
  if (((_a = mmlCharacterDescription.base) == null ? void 0 : _a.url.length) === 0) {
711
711
  throw new Error(
712
712
  "ERROR: An MML Character Description was provided but it's not a valid <m-character> string, or a valid URL"
@@ -715,14 +715,13 @@ var CharacterModel = class {
715
715
  let mergedCharacter = null;
716
716
  if (mmlCharacterDescription) {
717
717
  const characterBase = ((_b = mmlCharacterDescription.base) == null ? void 0 : _b.url) || null;
718
- const parts = [];
719
- (_c = mmlCharacterDescription.parts) == null ? void 0 : _c.forEach((part) => {
720
- if (part.url)
721
- parts.push(part.url);
722
- });
723
718
  if (characterBase) {
719
+ this.mmlCharacterDescription = mmlCharacterDescription;
724
720
  const mmlCharacter = new MMLCharacter(new ModelLoader());
725
- mergedCharacter = await mmlCharacter.mergeBodyParts(characterBase, parts);
721
+ mergedCharacter = await mmlCharacter.mergeBodyParts(
722
+ characterBase,
723
+ mmlCharacterDescription.parts
724
+ );
726
725
  if (mergedCharacter) {
727
726
  return mergedCharacter.children[0].children[0];
728
727
  }