roavatar-renderer 1.2.10 → 1.2.11

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/README.md CHANGED
@@ -5,7 +5,7 @@ It was originally a part of that repository but has now gained independence
5
5
 
6
6
  Also available on npm: https://www.npmjs.com/package/roavatar-renderer
7
7
 
8
- IMPORTANT: Assets are NOT included in the npm module or this repository, you have to get them from the main RoAvatar repository
8
+ IMPORTANT: Assets are NOT included in the npm module or this repository, you have to get them from the main RoAvatar repository OR set FLAGS.ONLINE_ASSETS = true
9
9
 
10
10
  Basic example on how to load an avatar, that is also untested:
11
11
  ```html
@@ -14,8 +14,13 @@ Basic example on how to load an avatar, that is also untested:
14
14
  ```
15
15
  ```ts
16
16
  //setup flags that are compatible with you environment
17
- //path to asset files from RoAvatar
18
- FLAGS.ASSETS_PATH = chrome.runtime.getURL("assets/rbxasset/")
17
+ FLAGS.ONLINE_ASSETS = false //set this to true if you want assets to be loaded from roblox instead of locally
18
+
19
+ if (!FLAGS.ONLINE_ASSETS) {
20
+ //path to asset files from RoAvatar
21
+ FLAGS.ASSETS_PATH = chrome.runtime.getURL("assets/rbxasset/")
22
+ FLAGS.RIG_PATH = chrome.runtime.getURL("assets/")
23
+ }
19
24
  //if layered assets dont work set this to false (workers improve performance)
20
25
  FLAGS.USE_WORKERS = true
21
26
 
@@ -42,7 +47,7 @@ if (!(outfit instanceof Outfit)) throw new Error("Failed to get outfit")
42
47
  //used by api
43
48
  const auth = new Authentication()
44
49
  //manages outfit rendering for you
45
- const outfitRenderer = new OutfitRenderer(auth, outfit, chrome.runtime.getURL("assets/"))
50
+ const outfitRenderer = new OutfitRenderer(auth, outfit, "roavatar://")
46
51
  outfitRenderer.startAnimating()
47
52
  outfitRenderer.setMainAnimation("idle")
48
53
  ```
package/dist/index.d.ts CHANGED
@@ -718,6 +718,8 @@ export declare class Content {
718
718
  externalObject?: Instance;
719
719
  }
720
720
 
721
+ export declare const ContentMap: Map<string, string>;
722
+
721
723
  declare class COREMESH {
722
724
  numverts: number;
723
725
  verts: FileMeshVertex[];
@@ -728,6 +730,8 @@ declare class COREMESH {
728
730
  getTouchingVerts(index: number): number[];
729
731
  }
730
732
 
733
+ export declare function createContentMap(): void;
734
+
731
735
  export declare function createMeshChunks(mesh: FileMesh, widthSplit: number, heightSplit: number, depthSplit: number): MeshChunk[];
732
736
 
733
737
  /**THIS FUNCTION IS SO EXPENSIVE IT NEEDS TO BE ASYNC SO JS DOESNT CRASH, USE CHUNKED VERSION INSTEAD
@@ -954,6 +958,8 @@ export declare const FLAGS: {
954
958
  ROAVATAR_TRYON_PLACE: number;
955
959
  ASSETS_PATH: string;
956
960
  ASSETDELIVERY_V2: boolean;
961
+ ONLINE_ASSETS: boolean;
962
+ RIG_PATH: string;
957
963
  USE_WORKERS: boolean;
958
964
  ENABLE_LC_WEIGHT_CACHE: boolean;
959
965
  INFLATE_LAYERED_CLOTHING: number;
@@ -1593,7 +1599,6 @@ export declare class ModelWrapper extends InstanceWrapper {
1593
1599
  static requiredProperties: string[];
1594
1600
  setup(): void;
1595
1601
  GetModelCFrame(): CFrame;
1596
- GetExtentsSize(): Vector3;
1597
1602
  }
1598
1603
 
1599
1604
  /**
package/dist/index.js CHANGED
@@ -29712,8 +29712,11 @@ const FLAGS = {
29712
29712
  ROAVATAR_DATA_URL: "rbxassetid://102463700065175",
29713
29713
  //url of model to load that lists issues with specific versions
29714
29714
  ROAVATAR_TRYON_PLACE: 135979364355750,
29715
- ASSETS_PATH: "../assets/rbxasset/",
29716
29715
  ASSETDELIVERY_V2: true,
29716
+ //assets
29717
+ ONLINE_ASSETS: false,
29718
+ ASSETS_PATH: "../assets/rbxasset/",
29719
+ RIG_PATH: "../assets/",
29717
29720
  //layered clothing
29718
29721
  USE_WORKERS: true,
29719
29722
  ENABLE_LC_WEIGHT_CACHE: true,
@@ -35053,25 +35056,106 @@ const CACHE = {
35053
35056
  "UserInfo": void 0
35054
35057
  };
35055
35058
  const ContentMap = /* @__PURE__ */ new Map();
35056
- ContentMap.set("rbxasset://fonts/BaseballCap.mesh", "12220916");
35057
- ContentMap.set("rbxasset://fonts/clonewand.mesh", "12221344");
35058
- ContentMap.set("rbxasset://fonts/fusedgirl.mesh", "12221423");
35059
- ContentMap.set("rbxasset://fonts/girlhair.mesh", "12221431");
35060
- ContentMap.set("rbxasset://fonts/hammer.mesh", "12221451");
35061
- ContentMap.set("rbxasset://fonts/NinjaMask.mesh", "12221524");
35062
- ContentMap.set("rbxasset://fonts/paintballgun.mesh", "11900867");
35063
- ContentMap.set("rbxasset://fonts/pawn.mesh", "12221585");
35064
- ContentMap.set("rbxasset://fonts/PirateHat.mesh", "12221595");
35065
- ContentMap.set("rbxasset://fonts/PoliceCap.mesh", "12221603");
35066
- ContentMap.set("rbxasset://fonts/rocketlauncher.mesh", "12221651");
35067
- ContentMap.set("rbxasset://fonts/slingshot.mesh", "12221682");
35068
- ContentMap.set("rbxasset://fonts/sombrero.mesh", "12221705");
35069
- ContentMap.set("rbxasset://fonts/sword.mesh", "12221720");
35070
- ContentMap.set("rbxasset://fonts/timebomb.mesh", "12221733");
35071
- ContentMap.set("rbxasset://fonts/tophat.mesh", "12221750");
35072
- ContentMap.set("rbxasset://fonts/tree.mesh", "12221787");
35073
- ContentMap.set("rbxasset://fonts/trowel.mesh", "12221793");
35074
- ContentMap.set("rbxasset://fonts/VikingHelmet.mesh", "12221815");
35059
+ function createContentMap() {
35060
+ ContentMap.set("rbxasset://fonts/BaseballCap.mesh", "12220916");
35061
+ ContentMap.set("rbxasset://fonts/clonewand.mesh", "12221344");
35062
+ ContentMap.set("rbxasset://fonts/fusedgirl.mesh", "12221423");
35063
+ ContentMap.set("rbxasset://fonts/girlhair.mesh", "12221431");
35064
+ ContentMap.set("rbxasset://fonts/hammer.mesh", "12221451");
35065
+ ContentMap.set("rbxasset://fonts/NinjaMask.mesh", "12221524");
35066
+ ContentMap.set("rbxasset://fonts/paintballgun.mesh", "11900867");
35067
+ ContentMap.set("rbxasset://fonts/pawn.mesh", "12221585");
35068
+ ContentMap.set("rbxasset://fonts/PirateHat.mesh", "12221595");
35069
+ ContentMap.set("rbxasset://fonts/PoliceCap.mesh", "12221603");
35070
+ ContentMap.set("rbxasset://fonts/rocketlauncher.mesh", "12221651");
35071
+ ContentMap.set("rbxasset://fonts/slingshot.mesh", "12221682");
35072
+ ContentMap.set("rbxasset://fonts/sombrero.mesh", "12221705");
35073
+ ContentMap.set("rbxasset://fonts/sword.mesh", "12221720");
35074
+ ContentMap.set("rbxasset://fonts/timebomb.mesh", "12221733");
35075
+ ContentMap.set("rbxasset://fonts/tophat.mesh", "12221750");
35076
+ ContentMap.set("rbxasset://fonts/tree.mesh", "12221787");
35077
+ ContentMap.set("rbxasset://fonts/trowel.mesh", "12221793");
35078
+ ContentMap.set("rbxasset://fonts/VikingHelmet.mesh", "12221815");
35079
+ if (FLAGS.ONLINE_ASSETS) {
35080
+ ContentMap.set("rbxasset://textures/particles/SquareParticle.png", "rbxassetid://81536466622192");
35081
+ ContentMap.set("rbxasset://textures/particles/sparkles_main.png", "rbxassetid://87394320952325");
35082
+ ContentMap.set("rbxasset://textures/particles/sparkles_color.png", "rbxassetid://133057519435872");
35083
+ ContentMap.set("rbxasset://textures/particles/smoke_main.png", "rbxassetid://138162637433023");
35084
+ ContentMap.set("rbxasset://textures/particles/smoke_color.png", "rbxassetid://125845160650254");
35085
+ ContentMap.set("rbxasset://textures/particles/legacy_fire_alpha_color.png", "rbxassetid://118480963109188");
35086
+ ContentMap.set("rbxasset://textures/particles/forcefield_vortex_main.png", "rbxassetid://90748587720186");
35087
+ ContentMap.set("rbxasset://textures/particles/forcefield_vortex_color.png", "rbxassetid://114134905691033");
35088
+ ContentMap.set("rbxasset://textures/particles/forcefield_glow_main.png", "rbxassetid://118476782259878");
35089
+ ContentMap.set("rbxasset://textures/particles/forcefield_glow_color.png", "rbxassetid://136830612119909");
35090
+ ContentMap.set("rbxasset://textures/particles/forcefield_glow_alpha.png", "rbxassetid://127202098262235");
35091
+ ContentMap.set("rbxasset://textures/particles/forcefield_alpha.png", "rbxassetid://114076943026381");
35092
+ ContentMap.set("rbxasset://textures/particles/fire_sparks_main.png", "rbxassetid://104223768023861");
35093
+ ContentMap.set("rbxasset://textures/particles/fire_sparks_color.png", "rbxassetid://140709297018478");
35094
+ ContentMap.set("rbxasset://textures/particles/fire_main.png", "rbxassetid://95195318391696");
35095
+ ContentMap.set("rbxasset://textures/particles/fire_color.png", "rbxassetid://71855354689630");
35096
+ ContentMap.set("rbxasset://textures/particles/fire_alpha.png", "rbxassetid://137123937216738");
35097
+ ContentMap.set("rbxasset://textures/particles/explosion01_smoke_main.png", "rbxassetid://93992972651499");
35098
+ ContentMap.set("rbxasset://textures/particles/explosion01_smoke_color_new.png", "rbxassetid://86144670293531");
35099
+ ContentMap.set("rbxasset://textures/particles/explosion01_smoke_alpha.png", "rbxassetid://138742967158809");
35100
+ ContentMap.set("rbxasset://textures/particles/explosion01_shockwave_main.png", "rbxassetid://116101962979677");
35101
+ ContentMap.set("rbxasset://textures/particles/explosion01_implosion_main.png", "rbxassetid://86764380638770");
35102
+ ContentMap.set("rbxasset://textures/particles/explosion01_implosion_color.png", "rbxassetid://127669378194473");
35103
+ ContentMap.set("rbxasset://textures/particles/explosion01_core_main.png", "rbxassetid://94075508535469");
35104
+ ContentMap.set("rbxasset://textures/particles/explosion01_core_alpha.png", "rbxassetid://99241903368204");
35105
+ ContentMap.set("rbxasset://textures/particles/explosion_color.png", "rbxassetid://93670753826336");
35106
+ ContentMap.set("rbxasset://textures/particles/explosion_alpha.png", "rbxassetid://115975840525503");
35107
+ ContentMap.set("rbxasset://textures/particles/common_alpha.png", "rbxassetid://76897028114182");
35108
+ ContentMap.set("rbxasset://textures/face.png", "rbxassetid://126076136486265");
35109
+ ContentMap.set("rbxasset://avatar/meshes/torso.mesh", "85617550700848");
35110
+ ContentMap.set("rbxasset://avatar/meshes/rightleg.mesh", "72388106457735");
35111
+ ContentMap.set("rbxasset://avatar/meshes/rightarm.mesh", "111146997566389");
35112
+ ContentMap.set("rbxasset://avatar/meshes/leftleg.mesh", "90013209978879");
35113
+ ContentMap.set("rbxasset://avatar/meshes/leftarm.mesh", "107015122138989");
35114
+ ContentMap.set("rbxasset://avatar/heads/headP.mesh", "92893933522111");
35115
+ ContentMap.set("rbxasset://avatar/heads/headO.mesh", "77541016415293");
35116
+ ContentMap.set("rbxasset://avatar/heads/headN.mesh", "135830315772083");
35117
+ ContentMap.set("rbxasset://avatar/heads/headM.mesh", "72296270663395");
35118
+ ContentMap.set("rbxasset://avatar/heads/headL.mesh", "118173713712494");
35119
+ ContentMap.set("rbxasset://avatar/heads/headK.mesh", "87988019718389");
35120
+ ContentMap.set("rbxasset://avatar/heads/headJ.mesh", "87602015805248");
35121
+ ContentMap.set("rbxasset://avatar/heads/headI.mesh", "105758863945258");
35122
+ ContentMap.set("rbxasset://avatar/heads/headH.mesh", "82654813279081");
35123
+ ContentMap.set("rbxasset://avatar/heads/headG.mesh", "78217037620613");
35124
+ ContentMap.set("rbxasset://avatar/heads/headF.mesh", "81353062523004");
35125
+ ContentMap.set("rbxasset://avatar/heads/headE.mesh", "113298530836166");
35126
+ ContentMap.set("rbxasset://avatar/heads/headD.mesh", "84378174703962");
35127
+ ContentMap.set("rbxasset://avatar/heads/headC.mesh", "114955209749256");
35128
+ ContentMap.set("rbxasset://avatar/heads/headB.mesh", "86540893905615");
35129
+ ContentMap.set("rbxasset://avatar/heads/headA.mesh", "77314442147190");
35130
+ ContentMap.set("rbxasset://avatar/heads/head.mesh", "84927473172716");
35131
+ ContentMap.set("rbxasset://avatar/compositing/R15CompositTorsoBase.mesh", "128898737887110");
35132
+ ContentMap.set("rbxasset://avatar/compositing/R15CompositRightArmBase.mesh", "130403245999873");
35133
+ ContentMap.set("rbxasset://avatar/compositing/R15CompositLeftArmBase.mesh", "122438986243654");
35134
+ ContentMap.set("rbxasset://avatar/compositing/CompositTShirt.mesh", "73352601509228");
35135
+ ContentMap.set("rbxasset://avatar/compositing/CompositTorsoBase.mesh", "110815013780474");
35136
+ ContentMap.set("rbxasset://avatar/compositing/CompositShirtTemplate.mesh", "99918409598660");
35137
+ ContentMap.set("rbxasset://avatar/compositing/CompositRightLegBase.mesh", "107252470435894");
35138
+ ContentMap.set("rbxasset://avatar/compositing/CompositRightArmBase.mesh", "86285571969113");
35139
+ ContentMap.set("rbxasset://avatar/compositing/CompositQuad.mesh", "86988649991001");
35140
+ ContentMap.set("rbxasset://avatar/compositing/CompositPantsTemplate.mesh", "108749124518615");
35141
+ ContentMap.set("rbxasset://avatar/compositing/CompositLeftLegBase.mesh", "126843307192697");
35142
+ ContentMap.set("rbxasset://avatar/compositing/CompositLeftArmBase.mesh", "124757651657333");
35143
+ ContentMap.set("rbxasset://avatar/compositing/CompositFullAtlasOverlayTexture.mesh", "99832238544592");
35144
+ ContentMap.set("rbxasset://avatar/compositing/CompositFullAtlasBaseTexture.mesh", "82745085603378");
35145
+ ContentMap.set("rbxasset://avatar/compositing/CompositExtraSlot4.mesh", "90442767118712");
35146
+ ContentMap.set("rbxasset://avatar/compositing/CompositExtraSlot3.mesh", "114465125672717");
35147
+ ContentMap.set("rbxasset://avatar/compositing/CompositExtraSlot2.mesh", "111697299800137");
35148
+ ContentMap.set("rbxasset://avatar/compositing/CompositExtraSlot1.mesh", "92101687933174");
35149
+ ContentMap.set("rbxasset://avatar/compositing/CompositExtraSlot0.mesh", "115275146529093");
35150
+ }
35151
+ if (FLAGS.ONLINE_ASSETS) {
35152
+ ContentMap.set("roavatar://RigR6.rbxm", "134202675113006");
35153
+ ContentMap.set("roavatar://RigR15.rbxm", "117612227055721");
35154
+ } else {
35155
+ ContentMap.set("roavatar://RigR6.rbxm", FLAGS.RIG_PATH + "RigR6.rbxm");
35156
+ ContentMap.set("roavatar://RigR15.rbxm", FLAGS.RIG_PATH + "RigR15.rbxm");
35157
+ }
35158
+ }
35075
35159
  let CachedRoAvatarData = void 0;
35076
35160
  let ThumbnailsToBatch = [];
35077
35161
  const API = {
@@ -35092,7 +35176,7 @@ const API = {
35092
35176
  let url = str;
35093
35177
  const contentUrl = ContentMap.get(str);
35094
35178
  if (contentUrl) {
35095
- console.log("contentUrl", contentUrl);
35179
+ console.log(`ContentMap: ${str} -> ${contentUrl}`);
35096
35180
  str = contentUrl;
35097
35181
  url = str;
35098
35182
  }
@@ -61072,7 +61156,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
61072
61156
  }));
61073
61157
  } else {
61074
61158
  promises.push(new Promise((resolve) => {
61075
- API.Asset.GetRBX(avatarType === AvatarType.R6 ? "../assets/RigR6.rbxm" : "../assets/RigR15.rbxm", void 0).then((result) => {
61159
+ API.Asset.GetRBX(avatarType === AvatarType.R6 ? "roavatar://RigR6.rbxm" : "roavatar://RigR15.rbxm", void 0).then((result) => {
61076
61160
  if (this.cancelApply) resolve(void 0);
61077
61161
  if (result instanceof RBX) {
61078
61162
  const dataModel = result.generateTree();
@@ -61783,35 +61867,6 @@ class WeldWrapper extends InstanceWrapper {
61783
61867
  class ManualWeldWrapper extends WeldWrapper {
61784
61868
  static className = "ManualWeld";
61785
61869
  }
61786
- function getCorners(cframe, size2) {
61787
- const halfX = size2.X / 2;
61788
- const halfY = size2.Y / 2;
61789
- const halfZ = size2.Z / 2;
61790
- return [
61791
- cframe.multiply(new CFrame(halfX, halfY, halfZ)),
61792
- cframe.multiply(new CFrame(halfX, halfY, -halfZ)),
61793
- cframe.multiply(new CFrame(-halfX, halfY, halfZ)),
61794
- cframe.multiply(new CFrame(-halfX, halfY, -halfZ)),
61795
- cframe.multiply(new CFrame(halfX, -halfY, halfZ)),
61796
- cframe.multiply(new CFrame(halfX, -halfY, -halfZ)),
61797
- cframe.multiply(new CFrame(-halfX, -halfY, halfZ)),
61798
- cframe.multiply(new CFrame(-halfX, -halfY, -halfZ))
61799
- ];
61800
- }
61801
- function getLower(a, b) {
61802
- return new Vector32(
61803
- a.X < b.X ? a.X : b.X,
61804
- a.Y < b.Y ? a.Y : b.Y,
61805
- a.Z < b.Z ? a.Z : b.Z
61806
- );
61807
- }
61808
- function getHigher(a, b) {
61809
- return new Vector32(
61810
- a.X > b.X ? a.X : b.X,
61811
- a.Y > b.Y ? a.Y : b.Y,
61812
- a.Z > b.Z ? a.Z : b.Z
61813
- );
61814
- }
61815
61870
  class ModelWrapper extends InstanceWrapper {
61816
61871
  static className = "Model";
61817
61872
  static requiredProperties = ["Name", "PrimaryPart"];
@@ -61826,22 +61881,6 @@ class ModelWrapper extends InstanceWrapper {
61826
61881
  }
61827
61882
  throw new Error("Model has no PrimaryPart");
61828
61883
  }
61829
- GetExtentsSize() {
61830
- let lowerExtents = new Vector32(0, 0, 0);
61831
- let higherExtents = new Vector32(0, 0, 0);
61832
- for (const child of this.instance.GetDescendants()) {
61833
- if (child.className === "Part" || child.className === "MeshPart") {
61834
- const cframe = traverseRigCFrame(child);
61835
- const size2 = child.Prop("Size");
61836
- const corners = getCorners(cframe, size2);
61837
- for (const corner of corners) {
61838
- lowerExtents = getLower(lowerExtents, new Vector32().fromVec3(corner.Position));
61839
- higherExtents = getHigher(higherExtents, new Vector32().fromVec3(corner.Position));
61840
- }
61841
- }
61842
- }
61843
- return higherExtents.minus(lowerExtents);
61844
- }
61845
61884
  }
61846
61885
  class Motor6DWrapper extends WeldWrapper {
61847
61886
  static className = "Motor6D";
@@ -62108,6 +62147,7 @@ class RBXRenderer {
62108
62147
  static error;
62109
62148
  static async boilerplateSetup() {
62110
62149
  RegisterWrappers();
62150
+ createContentMap();
62111
62151
  setupWorkerPool();
62112
62152
  loadCompositMeshes();
62113
62153
  }
@@ -62881,6 +62921,7 @@ export {
62881
62921
  ColorSequenceKeypoint,
62882
62922
  Connection,
62883
62923
  Content,
62924
+ ContentMap,
62884
62925
  DataType,
62885
62926
  DefaultAnimations,
62886
62927
  DefaultAnimationsR6,
@@ -62977,6 +63018,7 @@ export {
62977
63018
  clonePrimitiveArray,
62978
63019
  cloneSearch_Payload,
62979
63020
  closestPointTriangle,
63021
+ createContentMap,
62980
63022
  createMeshChunks,
62981
63023
  createWeightsForMesh,
62982
63024
  createWeightsForMeshChunked,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",