roavatar-renderer 1.2.4 → 1.2.5

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
@@ -942,6 +942,7 @@ export declare const FLAGS: {
942
942
  ENABLE_LC_WEIGHT_CACHE: boolean;
943
943
  INFLATE_LAYERED_CLOTHING: number;
944
944
  LAYERED_CLOTHING_ALGORITHM: "linear" | "linearnormal" | "linearnormal2" | "rbf";
945
+ SHOW_CAGE: boolean;
945
946
  RBF_PATCH_COUNT: number;
946
947
  RBF_PATCH_DETAIL_SAMPLES: number;
947
948
  RBF_PATCH_SHAPE_SAMPLES: number;
@@ -951,6 +952,7 @@ export declare const FLAGS: {
951
952
  GEAR_ENABLED: boolean;
952
953
  AUDIO_ENABLED: boolean;
953
954
  LEGACY_WELD_BEHAVIOR: boolean;
955
+ USE_RENDERTARGET: boolean;
954
956
  SHOW_SKELETON_HELPER: boolean;
955
957
  UPDATE_SKELETON: boolean;
956
958
  ANIMATE_SKELETON: boolean;
package/dist/index.js CHANGED
@@ -28256,6 +28256,7 @@ const FLAGS = {
28256
28256
  INFLATE_LAYERED_CLOTHING: 0.05,
28257
28257
  //only used by linear algorithms
28258
28258
  LAYERED_CLOTHING_ALGORITHM: "rbf",
28259
+ SHOW_CAGE: false,
28259
28260
  RBF_PATCH_COUNT: 300,
28260
28261
  //amount of "patches" that are used for layered clothing, multiple verts share the same patch
28261
28262
  RBF_PATCH_DETAIL_SAMPLES: 32,
@@ -28271,6 +28272,7 @@ const FLAGS = {
28271
28272
  GEAR_ENABLED: true,
28272
28273
  AUDIO_ENABLED: true,
28273
28274
  LEGACY_WELD_BEHAVIOR: false,
28275
+ USE_RENDERTARGET: true,
28274
28276
  //skeleton
28275
28277
  SHOW_SKELETON_HELPER: false,
28276
28278
  UPDATE_SKELETON: true,
@@ -34490,6 +34492,22 @@ async function RBLXDelete(url, auth, body, attempt = 0) {
34490
34492
  async function RBLXPatch(url, auth, body, attempt = 0) {
34491
34493
  return RBLXPost(url, auth, body, attempt, "PATCH");
34492
34494
  }
34495
+ async function getAssetBufferInternal(url, headers) {
34496
+ API.Misc.startCurrentlyLoadingAssets();
34497
+ const fetchStr = await API.Misc.assetURLToCDNURL(url, headers);
34498
+ if (fetchStr instanceof Response) {
34499
+ API.Misc.stopCurrentlyLoadingAssets();
34500
+ return fetchStr;
34501
+ }
34502
+ const response = await RBLXGet(fetchStr, void 0, false);
34503
+ API.Misc.stopCurrentlyLoadingAssets();
34504
+ if (response.status === 200) {
34505
+ const data = await response.arrayBuffer();
34506
+ return data;
34507
+ } else {
34508
+ return response;
34509
+ }
34510
+ }
34493
34511
  let isCurrentlyLoading = false;
34494
34512
  let currentlyLoadingAssets = 0;
34495
34513
  function _updateCurrentlyLoadingAssets() {
@@ -34889,23 +34907,15 @@ const API = {
34889
34907
  if (cachedBuffer) {
34890
34908
  return cachedBuffer;
34891
34909
  } else {
34892
- API.Misc.startCurrentlyLoadingAssets();
34893
- const fetchStr = await API.Misc.assetURLToCDNURL(url, headers);
34894
- if (fetchStr instanceof Response) {
34895
- API.Misc.stopCurrentlyLoadingAssets();
34896
- return fetchStr;
34897
- }
34898
- const response = await RBLXGet(fetchStr, void 0, false);
34899
- API.Misc.stopCurrentlyLoadingAssets();
34900
- if (response.status === 200) {
34901
- const data = await response.arrayBuffer();
34902
- if (FLAGS.ENABLE_API_CACHE) {
34903
- CACHE.AssetBuffer.set(cacheStr, data);
34904
- }
34905
- return data;
34906
- } else {
34907
- return response;
34910
+ const promise = new Promise((resolve) => {
34911
+ getAssetBufferInternal(url, headers).then((result) => {
34912
+ resolve(result);
34913
+ });
34914
+ });
34915
+ if (FLAGS.ENABLE_API_CACHE) {
34916
+ CACHE.AssetBuffer.set(cacheStr, promise);
34908
34917
  }
34918
+ return promise;
34909
34919
  }
34910
34920
  },
34911
34921
  GetRBX: async function(url, headers) {
@@ -54225,6 +54235,9 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
54225
54235
  lastMotor6D = instance.FindFirstChildOfClass("Motor6D");
54226
54236
  if (!lastMotor6D) {
54227
54237
  lastMotor6D = instance.FindFirstChildOfClass("Weld");
54238
+ if (!lastMotor6D) {
54239
+ lastMotor6D = instance.FindFirstChildOfClass("ManualWeld");
54240
+ }
54228
54241
  }
54229
54242
  }
54230
54243
  while (lastMotor6D) {
@@ -54241,12 +54254,15 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
54241
54254
  lastMotor6D = ogPart0?.FindFirstChildOfClass("Motor6D");
54242
54255
  if (!lastMotor6D) {
54243
54256
  lastMotor6D = ogPart0?.FindFirstChildOfClass("Weld");
54257
+ if (!lastMotor6D) {
54258
+ lastMotor6D = ogPart0?.FindFirstChildOfClass("ManualWeld");
54259
+ }
54244
54260
  }
54245
54261
  if (lastMotor6D && lastMotor6D.PropOrDefault("Part1", void 0) !== ogPart0) {
54246
54262
  const descendants = ogLastMotor6D.parent?.parent?.GetDescendants() || [];
54247
54263
  let foundMotor = false;
54248
54264
  for (const child of descendants) {
54249
- if ((child.className === "Motor6D" || child.className === "Weld") && child.PropOrDefault("Part1", void 0) === ogPart0) {
54265
+ if ((child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") && child.PropOrDefault("Part1", void 0) === ogPart0) {
54250
54266
  lastMotor6D = child;
54251
54267
  foundMotor = true;
54252
54268
  break;
@@ -54260,7 +54276,7 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
54260
54276
  const descendants = ogLastMotor6D.parent?.parent?.GetDescendants() || [];
54261
54277
  let foundMotor = false;
54262
54278
  for (const child of descendants) {
54263
- if ((child.className === "Motor6D" || child.className === "Weld") && child.PropOrDefault("Part1", void 0) === ogPart0) {
54279
+ if ((child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") && child.PropOrDefault("Part1", void 0) === ogPart0) {
54264
54280
  lastMotor6D = child;
54265
54281
  foundMotor = true;
54266
54282
  break;
@@ -55204,6 +55220,12 @@ class MeshDesc {
55204
55220
  break;
55205
55221
  }
55206
55222
  }
55223
+ if (FLAGS.SHOW_CAGE) {
55224
+ the_ref_mesh = dist_mesh;
55225
+ the_ref_mesh.skinning.skinnings = [];
55226
+ the_ref_mesh.skinning.bones = [];
55227
+ the_ref_mesh.skinning.subsets = [];
55228
+ }
55207
55229
  const layeredClothingCacheId = `${this.mesh}-${this.layerDesc.reference}`;
55208
55230
  switch (FLAGS.LAYERED_CLOTHING_ALGORITHM) {
55209
55231
  case "rbf": {
@@ -55246,7 +55268,7 @@ class MeshDesc {
55246
55268
  }
55247
55269
  offsetMesh(mesh, totalOffset);
55248
55270
  }
55249
- the_ref_mesh = void 0;
55271
+ if (!FLAGS.SHOW_CAGE) the_ref_mesh = void 0;
55250
55272
  if (FLAGS.HIDE_LAYERED_CLOTHING) return;
55251
55273
  }
55252
55274
  if (this.target && this.targetOrigin && this.hsrDesc) {
@@ -55323,6 +55345,7 @@ class MeshDesc {
55323
55345
  }
55324
55346
  threeMesh.castShadow = true;
55325
55347
  threeMesh.geometry = geometry;
55348
+ threeMesh.name = this.instance?.PropOrDefault("Name", "Mesh");
55326
55349
  threeMesh.scale.set(mesh.size[0], mesh.size[1], mesh.size[2]);
55327
55350
  this.compilationTimestamp = Date.now() / 1e3;
55328
55351
  return threeMesh;
@@ -56277,9 +56300,9 @@ class MaterialDesc {
56277
56300
  }
56278
56301
  }
56279
56302
  if (!hasLayerOfType) return;
56280
- if (hasSpecialUVType || this.bodyPart !== void 0) {
56303
+ if ((hasSpecialUVType || this.bodyPart !== void 0) && FLAGS.USE_RENDERTARGET) {
56281
56304
  return this.compileTexture_FullCompose(textureType, meshDesc);
56282
- } else if (this.layers.length > 1 || hasColorLayer) {
56305
+ } else if (this.layers.length > 1 || hasColorLayer && FLAGS.USE_RENDERTARGET) {
56283
56306
  return this.compileTexture_SimpleCompose(textureType);
56284
56307
  } else {
56285
56308
  let textureUrl = void 0;
@@ -60700,7 +60723,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
60700
60723
  }
60701
60724
  const handle = tool.FindFirstChild("Handle");
60702
60725
  for (const child of tool.GetDescendants()) {
60703
- if (child.className === "Motor6D" || child.className === "Weld") {
60726
+ if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
60704
60727
  if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
60705
60728
  const part0 = child.Prop("Part0");
60706
60729
  const part1 = child.Prop("Part1");
@@ -61109,66 +61132,6 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
61109
61132
  return this.instance;
61110
61133
  }
61111
61134
  }
61112
- function getCorners(cframe, size2) {
61113
- const halfX = size2.X / 2;
61114
- const halfY = size2.Y / 2;
61115
- const halfZ = size2.Z / 2;
61116
- return [
61117
- cframe.multiply(new CFrame(halfX, halfY, halfZ)),
61118
- cframe.multiply(new CFrame(halfX, halfY, -halfZ)),
61119
- cframe.multiply(new CFrame(-halfX, halfY, halfZ)),
61120
- cframe.multiply(new CFrame(-halfX, halfY, -halfZ)),
61121
- cframe.multiply(new CFrame(halfX, -halfY, halfZ)),
61122
- cframe.multiply(new CFrame(halfX, -halfY, -halfZ)),
61123
- cframe.multiply(new CFrame(-halfX, -halfY, halfZ)),
61124
- cframe.multiply(new CFrame(-halfX, -halfY, -halfZ))
61125
- ];
61126
- }
61127
- function getLower(a, b) {
61128
- return new Vector32(
61129
- a.X < b.X ? a.X : b.X,
61130
- a.Y < b.Y ? a.Y : b.Y,
61131
- a.Z < b.Z ? a.Z : b.Z
61132
- );
61133
- }
61134
- function getHigher(a, b) {
61135
- return new Vector32(
61136
- a.X > b.X ? a.X : b.X,
61137
- a.Y > b.Y ? a.Y : b.Y,
61138
- a.Z > b.Z ? a.Z : b.Z
61139
- );
61140
- }
61141
- class ModelWrapper extends InstanceWrapper {
61142
- static className = "Model";
61143
- static requiredProperties = ["Name", "PrimaryPart"];
61144
- setup() {
61145
- if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), "Model");
61146
- if (!this.instance.HasProperty("PrimaryPart")) this.instance.addProperty(new Property("PrimaryPart", DataType.Referent), void 0);
61147
- }
61148
- GetModelCFrame() {
61149
- const primaryPart = this.instance.Prop("PrimaryPart");
61150
- if (primaryPart) {
61151
- return primaryPart.Prop("CFrame");
61152
- }
61153
- throw new Error("Model has no PrimaryPart");
61154
- }
61155
- GetExtentsSize() {
61156
- let lowerExtents = new Vector32(0, 0, 0);
61157
- let higherExtents = new Vector32(0, 0, 0);
61158
- for (const child of this.instance.GetDescendants()) {
61159
- if (child.className === "Part" || child.className === "MeshPart") {
61160
- const cframe = traverseRigCFrame(child);
61161
- const size2 = child.Prop("Size");
61162
- const corners = getCorners(cframe, size2);
61163
- for (const corner of corners) {
61164
- lowerExtents = getLower(lowerExtents, new Vector32().fromVec3(corner.Position));
61165
- higherExtents = getHigher(higherExtents, new Vector32().fromVec3(corner.Position));
61166
- }
61167
- }
61168
- }
61169
- return higherExtents.minus(lowerExtents);
61170
- }
61171
- }
61172
61135
  class WeldWrapperData {
61173
61136
  part0ChangedConnection;
61174
61137
  lastUpdateTime = 0;
@@ -61268,6 +61231,69 @@ class WeldWrapper extends InstanceWrapper {
61268
61231
  }
61269
61232
  }
61270
61233
  }
61234
+ class ManualWeldWrapper extends WeldWrapper {
61235
+ static className = "ManualWeld";
61236
+ }
61237
+ function getCorners(cframe, size2) {
61238
+ const halfX = size2.X / 2;
61239
+ const halfY = size2.Y / 2;
61240
+ const halfZ = size2.Z / 2;
61241
+ return [
61242
+ cframe.multiply(new CFrame(halfX, halfY, halfZ)),
61243
+ cframe.multiply(new CFrame(halfX, halfY, -halfZ)),
61244
+ cframe.multiply(new CFrame(-halfX, halfY, halfZ)),
61245
+ cframe.multiply(new CFrame(-halfX, halfY, -halfZ)),
61246
+ cframe.multiply(new CFrame(halfX, -halfY, halfZ)),
61247
+ cframe.multiply(new CFrame(halfX, -halfY, -halfZ)),
61248
+ cframe.multiply(new CFrame(-halfX, -halfY, halfZ)),
61249
+ cframe.multiply(new CFrame(-halfX, -halfY, -halfZ))
61250
+ ];
61251
+ }
61252
+ function getLower(a, b) {
61253
+ return new Vector32(
61254
+ a.X < b.X ? a.X : b.X,
61255
+ a.Y < b.Y ? a.Y : b.Y,
61256
+ a.Z < b.Z ? a.Z : b.Z
61257
+ );
61258
+ }
61259
+ function getHigher(a, b) {
61260
+ return new Vector32(
61261
+ a.X > b.X ? a.X : b.X,
61262
+ a.Y > b.Y ? a.Y : b.Y,
61263
+ a.Z > b.Z ? a.Z : b.Z
61264
+ );
61265
+ }
61266
+ class ModelWrapper extends InstanceWrapper {
61267
+ static className = "Model";
61268
+ static requiredProperties = ["Name", "PrimaryPart"];
61269
+ setup() {
61270
+ if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), "Model");
61271
+ if (!this.instance.HasProperty("PrimaryPart")) this.instance.addProperty(new Property("PrimaryPart", DataType.Referent), void 0);
61272
+ }
61273
+ GetModelCFrame() {
61274
+ const primaryPart = this.instance.Prop("PrimaryPart");
61275
+ if (primaryPart) {
61276
+ return primaryPart.Prop("CFrame");
61277
+ }
61278
+ throw new Error("Model has no PrimaryPart");
61279
+ }
61280
+ GetExtentsSize() {
61281
+ let lowerExtents = new Vector32(0, 0, 0);
61282
+ let higherExtents = new Vector32(0, 0, 0);
61283
+ for (const child of this.instance.GetDescendants()) {
61284
+ if (child.className === "Part" || child.className === "MeshPart") {
61285
+ const cframe = traverseRigCFrame(child);
61286
+ const size2 = child.Prop("Size");
61287
+ const corners = getCorners(cframe, size2);
61288
+ for (const corner of corners) {
61289
+ lowerExtents = getLower(lowerExtents, new Vector32().fromVec3(corner.Position));
61290
+ higherExtents = getHigher(higherExtents, new Vector32().fromVec3(corner.Position));
61291
+ }
61292
+ }
61293
+ }
61294
+ return higherExtents.minus(lowerExtents);
61295
+ }
61296
+ }
61271
61297
  class Motor6DWrapper extends WeldWrapper {
61272
61298
  static className = "Motor6D";
61273
61299
  static requiredProperties = [
@@ -61481,6 +61507,7 @@ function RegisterWrappers() {
61481
61507
  ToolWrapper.register();
61482
61508
  WeldWrapper.register();
61483
61509
  Motor6DWrapper.register();
61510
+ ManualWeldWrapper.register();
61484
61511
  AnimatorWrapper.register();
61485
61512
  FaceControlsWrapper.register();
61486
61513
  HumanoidDescriptionWrapper.register();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",