roavatar-renderer 1.2.6 → 1.2.8

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.d.ts CHANGED
@@ -73,6 +73,8 @@ export declare const AllCharacterSorts: ItemSort[];
73
73
 
74
74
  export declare const AllClothingSorts: ItemSort[];
75
75
 
76
+ export declare const AllHeadShapes: string[];
77
+
76
78
  export declare const AlphaMode: {
77
79
  Overlay: number;
78
80
  Transparency: number;
@@ -415,6 +417,7 @@ export declare interface AvatarInventory_Result {
415
417
  };
416
418
  availabilityStatus: string;
417
419
  acquisitionTime: string;
420
+ headShape?: string;
418
421
  outfitDetail?: {
419
422
  assets: {
420
423
  id: number;
@@ -1408,6 +1411,7 @@ export declare interface Look_Result {
1408
1411
  id: number;
1409
1412
  isIncluded: boolean;
1410
1413
  supportsHeadshapes?: boolean;
1414
+ meta?: AssetMetaJson;
1411
1415
  }[];
1412
1416
  bundleType: number | null;
1413
1417
  collectibleItemId: string;
@@ -1764,6 +1768,7 @@ export declare class Outfit {
1764
1768
  isOrderUsed(order: number, self?: Asset): boolean;
1765
1769
  getNextOrder(order: number): number;
1766
1770
  addAssetId(assetId: number, auth: Authentication): Promise<boolean>;
1771
+ addAssetIdEconomy(assetId: number): Promise<boolean>;
1767
1772
  addBundleId(bundleId: number): Promise<boolean>;
1768
1773
  getAssetId(assetId: number): Asset | undefined;
1769
1774
  fromLook(look: Look_Result["look"], auth: Authentication): Promise<boolean>;
package/dist/index.js CHANGED
@@ -954,6 +954,32 @@ const accessoryRefinementUpperBounds = {
954
954
  }
955
955
  }
956
956
  };
957
+ const AllHeadShapes = [
958
+ "RobloxClassic",
959
+ "Blockhead",
960
+ "Cheeks",
961
+ "Chiseled",
962
+ "CoolThing",
963
+ "EraserHead",
964
+ "FatHead",
965
+ "FlatTop",
966
+ "GoldenKorbloxGeneral",
967
+ "GoldenMrRobot",
968
+ "KnightOfChivalry",
969
+ "KnightOfCourage",
970
+ "ManHead",
971
+ "MercilessNinja",
972
+ "Narrow",
973
+ "Paragon",
974
+ "Peabrain",
975
+ "Perfection",
976
+ "Roll",
977
+ "Roundy",
978
+ "RoxBox",
979
+ "TheEngineer",
980
+ "Trim",
981
+ "WomanHead"
982
+ ];
957
983
  const REVISION = "180";
958
984
  const MOUSE = { ROTATE: 0, DOLLY: 1, PAN: 2 };
959
985
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -27346,6 +27372,9 @@ const animNamesR15 = {
27346
27372
  ],
27347
27373
  toollunge: [
27348
27374
  { id: "http://www.roblox.com/asset/?id=522638767", weight: 10 }
27375
+ ],
27376
+ mood: [
27377
+ { id: "http://www.roblox.com/asset/?id=14366558676", weight: 10 }
27349
27378
  ]
27350
27379
  /*wave: [
27351
27380
  { id: "http://www.roblox.com/asset/?id=507770239", weight: 10 }
@@ -31617,7 +31646,23 @@ class Outfit {
31617
31646
  return false;
31618
31647
  }
31619
31648
  const assetDetails = assetDetailsResponse;
31620
- this.addAsset(assetId, assetDetails.data[0].assetType, assetDetails.data[0].name, assetDetails.data[0].supportsHeadShapes);
31649
+ if (assetDetails.data.length > 0) {
31650
+ this.addAsset(assetId, assetDetails.data[0].assetType, assetDetails.data[0].name, assetDetails.data[0].supportsHeadShapes);
31651
+ } else {
31652
+ return this.addAssetIdEconomy(assetId);
31653
+ }
31654
+ return true;
31655
+ }
31656
+ async addAssetIdEconomy(assetId) {
31657
+ const assetDetailsResponse = await API.Economy.GetAssetDetails(assetId);
31658
+ if (assetDetailsResponse.status !== 200) {
31659
+ return false;
31660
+ }
31661
+ const assetDetails = await assetDetailsResponse.json();
31662
+ if (assetDetails.errors) {
31663
+ return false;
31664
+ }
31665
+ this.addAsset(assetId, assetDetails.AssetTypeId, assetDetails.Name);
31621
31666
  return true;
31622
31667
  }
31623
31668
  async addBundleId(bundleId) {
@@ -31665,8 +31710,18 @@ class Outfit {
31665
31710
  this.addAsset(item.id, item.assetType, item.name);
31666
31711
  } else if (item.itemType === "Bundle") {
31667
31712
  const assetsList = [];
31713
+ const assetMetaList = [];
31714
+ const assetIdList = [];
31668
31715
  for (const asset of item.assetsInBundle) {
31669
- assetsList.push({ itemType: "Asset", id: asset.id });
31716
+ if (asset.isIncluded) {
31717
+ assetsList.push({ itemType: "Asset", id: asset.id });
31718
+ if (asset.meta) {
31719
+ assetMetaList.push(asset.meta);
31720
+ } else {
31721
+ assetMetaList.push(void 0);
31722
+ }
31723
+ assetIdList.push(asset.id);
31724
+ }
31670
31725
  }
31671
31726
  const assetDetails = await API.Catalog.GetItemDetails(auth, assetsList);
31672
31727
  if (assetDetails instanceof Response) {
@@ -31674,6 +31729,15 @@ class Outfit {
31674
31729
  } else {
31675
31730
  for (const assetDetail of assetDetails.data) {
31676
31731
  this.addAsset(assetDetail.id, assetDetail.assetType, assetDetail.name, assetDetail.supportsHeadShapes);
31732
+ const index = assetIdList.indexOf(assetDetail.id);
31733
+ const meta = assetMetaList[index];
31734
+ if (meta) {
31735
+ const addedAsset = this.getAssetId(assetDetail.id);
31736
+ if (addedAsset) {
31737
+ addedAsset.meta = new AssetMeta();
31738
+ addedAsset.meta.fromJson(meta);
31739
+ }
31740
+ }
31677
31741
  }
31678
31742
  }
31679
31743
  }
@@ -31799,6 +31863,17 @@ class Outfit {
31799
31863
  for (const assetDetail of assetDetails.data) {
31800
31864
  this.addAsset(assetDetail.id, assetDetail.assetType, assetDetail.name, assetDetail.supportsHeadShapes);
31801
31865
  }
31866
+ for (const asset of assetsToAdd) {
31867
+ const assetId = asset.id;
31868
+ if (assetId && !this.getAssetId(assetId)) {
31869
+ assetPromises.push(new Promise((resolve) => {
31870
+ this.addAssetIdEconomy(assetId).then(() => {
31871
+ resolve(void 0);
31872
+ });
31873
+ }));
31874
+ }
31875
+ }
31876
+ await Promise.all(assetPromises);
31802
31877
  for (const assetToAdd of assetsToAdd) {
31803
31878
  let asset = void 0;
31804
31879
  for (const assetIn of this.assets) {
@@ -31810,7 +31885,6 @@ class Outfit {
31810
31885
  asset.meta = assetToAdd.meta;
31811
31886
  }
31812
31887
  }
31813
- await Promise.all(assetPromises);
31814
31888
  this.fixOrders();
31815
31889
  return this;
31816
31890
  }
@@ -32106,6 +32180,7 @@ const CategoryDictionary = {
32106
32180
  },
32107
32181
  "Head": {
32108
32182
  "Dynamic Heads": new SortInfo([new ItemSort(2, "Outfit")]),
32183
+ "Adjustment": new SpecialInfo("HeadAdjustment"),
32109
32184
  "Heads": new SortInfo([new ItemSort(17)], "inventory"),
32110
32185
  "Faces": new SortInfo([new ItemSort(18)], "inventory")
32111
32186
  },
@@ -35367,7 +35442,7 @@ const API = {
35367
35442
  });
35368
35443
  }
35369
35444
  for (const thumbnailInfo of ThumbnailsToBatch) {
35370
- if (thumbnailInfo.id === id && thumbnailInfo.type === type && thumbnailInfo.size === size2) {
35445
+ if (requestIdFromThumbnailInfo(thumbnailInfo) === requestIdFromThumbnailInfo(thisThumbnailInfo)) {
35371
35446
  return new Promise((resolve) => {
35372
35447
  thumbnailInfo.resolves.push(resolve);
35373
35448
  });
@@ -49029,6 +49104,10 @@ class WorkerPool {
49029
49104
  };
49030
49105
  worker.onerror = (e) => {
49031
49106
  console.warn(e);
49107
+ const index = this.workers.indexOf(worker);
49108
+ this.workers.splice(index, 1);
49109
+ this.workersActiveTasks.splice(index, 1);
49110
+ this.workersResolves.splice(index, 1);
49032
49111
  throw new Error("Failed to create worker, try disabling workers by setting FLAGS.USE_WORKERS = false but do note doing so will degrade performance");
49033
49112
  };
49034
49113
  }
@@ -59584,22 +59663,17 @@ class AnimatorWrapper extends InstanceWrapper {
59584
59663
  for (const track of this.data.animationTracks.values()) {
59585
59664
  if (!this.data.moodTracks.includes(track)) continue;
59586
59665
  const looped = track.tick(addTime);
59587
- if (this.data.currentAnimationTrack === track && looped && this.data.currentAnimation) {
59588
- this._switchAnimation(this.data.currentAnimation);
59666
+ if (this.data.currentMoodAnimationTrack === track && looped && this.data.currentMoodAnimation) {
59667
+ this._switchMoodAnimation(this.data.currentMoodAnimation);
59589
59668
  }
59590
59669
  }
59591
59670
  for (const track of this.data.animationTracks.values()) {
59592
59671
  if (!this.data.toolTracks.includes(track)) continue;
59593
59672
  const looped = track.tick(addTime);
59594
- if (this.data.currentAnimationTrack === track && looped && this.data.currentAnimation) {
59595
- this._switchAnimation(this.data.currentAnimation);
59673
+ if (this.data.currentToolAnimationTrack === track && looped && this.data.currentToolAnimation) {
59674
+ this._switchToolAnimation(this.data.currentToolAnimation);
59596
59675
  }
59597
59676
  }
59598
- const hasMood = this.data.currentMoodAnimation && this.data.currentMoodAnimation.length > 0;
59599
- const isEmote = this.data.currentAnimation?.startsWith("emote.");
59600
- if (!hasMood && !isEmote) {
59601
- this.restPose(false, true);
59602
- }
59603
59677
  const rig = this.instance.parent?.parent;
59604
59678
  if (rig) {
59605
59679
  const descedants = rig.GetDescendants();
@@ -61683,11 +61757,11 @@ class RBXRenderer {
61683
61757
  errorDiv.style = `
61684
61758
  display: flex;
61685
61759
  flex-direction: column;
61686
- justify-content: flex-start;
61760
+ justify-content: center;
61687
61761
  align-items: center;
61688
61762
  width: 100%;
61689
61763
  height: 100%;
61690
- background-color: rgb(237, 22, 97);
61764
+ background-color: rgb(255, 89, 89);
61691
61765
  `;
61692
61766
  const errorTitle = document.createElement("span");
61693
61767
  errorTitle.style = `
@@ -61705,6 +61779,7 @@ class RBXRenderer {
61705
61779
  font-size: 24px;
61706
61780
  color: #fff;
61707
61781
  text-align: center;
61782
+ max-width: 90%;
61708
61783
  `;
61709
61784
  errorText.innerText = "Your browser, device or settings do not support WebGL2";
61710
61785
  errorDiv.appendChild(errorText);
@@ -61715,6 +61790,7 @@ class RBXRenderer {
61715
61790
  color: #fff;
61716
61791
  text-align: center;
61717
61792
  `;
61793
+ errorLink.target = "_blank";
61718
61794
  errorLink.innerText = "Learn more";
61719
61795
  errorLink.href = "https://webglreport.com/?v=2";
61720
61796
  errorDiv.appendChild(errorLink);
@@ -62395,11 +62471,6 @@ class OutfitRenderer {
62395
62471
  animatorW.playAnimation(name2);
62396
62472
  });
62397
62473
  }
62398
- if (this.outfit.containsAssetType("MoodAnimation") && !name2.startsWith("emote.")) {
62399
- animatorW.playAnimation("mood", "mood");
62400
- } else {
62401
- animatorW.stopMoodAnimation();
62402
- }
62403
62474
  }
62404
62475
  }
62405
62476
  }
@@ -62419,6 +62490,7 @@ export {
62419
62490
  AllBodyPartsSorts,
62420
62491
  AllCharacterSorts,
62421
62492
  AllClothingSorts,
62493
+ AllHeadShapes,
62422
62494
  AlphaMode,
62423
62495
  AnimationPropToName,
62424
62496
  AnimationTrack,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",