roavatar-renderer 1.9.2 → 1.9.3

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
@@ -1436,6 +1436,11 @@ export declare function exposeFLAGS(): void;
1436
1436
  */
1437
1437
  export declare function exposeMesh(): void;
1438
1438
 
1439
+ /**
1440
+ * @category Exposer
1441
+ */
1442
+ export declare function exposeTests(): void;
1443
+
1439
1444
  /**
1440
1445
  * @category Exposer
1441
1446
  */
@@ -1695,6 +1700,8 @@ export declare const FLAGS: {
1695
1700
  SEARCH_FOR_STRING: string | undefined;
1696
1701
  /**only used by RoAvatar, set this to a string to load a place file, for example "../assets/UniversalApp.rbxm" */
1697
1702
  LOAD_TEST_PLACE: string | undefined;
1703
+ /**Used for autotests */
1704
+ AUTOTEST_MODEL: string;
1698
1705
  };
1699
1706
 
1700
1707
  declare class FloatCurve {
package/dist/index.js CHANGED
@@ -32648,8 +32648,9 @@ const FLAGS = {
32648
32648
  VERBOSE_LOGGING: false,
32649
32649
  SEARCH_FOR_STRING: void 0,
32650
32650
  //"requestparams" //"looks/" //this is useful if you want to find api endpoints
32651
- LOAD_TEST_PLACE: void 0
32651
+ LOAD_TEST_PLACE: void 0,
32652
32652
  //"../assets/UniversalApp.rbxm" //"../assets/WrapDeformerTest.rbxm" //"../assets/DecalTest2.rbxm" //"../assets/TransparentDominus.rbxm" //"../assets/EmissiveTest.rbxm" //"../assets/Mesh Deformation Test.rbxl" //set this to a string to load a place file
32653
+ AUTOTEST_MODEL: "rbxassetid://138879899842500"
32653
32654
  };
32654
32655
  function log(critical, ...args) {
32655
32656
  if (critical || FLAGS.VERBOSE_LOGGING) {
@@ -33229,7 +33230,13 @@ class CFrame {
33229
33230
  return newCF;
33230
33231
  }
33231
33232
  isSame(other) {
33232
- return isSameFloat(this.Position[0], other.Position[0]) && isSameFloat(this.Position[1], other.Position[1]) && isSameFloat(this.Position[2], other.Position[2]) && isSameFloat(this.Orientation[0], other.Orientation[0]) && isSameFloat(this.Orientation[1], other.Orientation[1]) && isSameFloat(this.Orientation[2], other.Orientation[2]);
33233
+ const so0 = Math.abs(this.Orientation[0]) > 179 ? Math.abs(this.Orientation[0]) : this.Orientation[0];
33234
+ const so1 = Math.abs(this.Orientation[1]) > 179 ? Math.abs(this.Orientation[1]) : this.Orientation[1];
33235
+ const so2 = Math.abs(this.Orientation[2]) > 179 ? Math.abs(this.Orientation[2]) : this.Orientation[2];
33236
+ const oo0 = Math.abs(other.Orientation[0]) > 179 ? Math.abs(other.Orientation[0]) : other.Orientation[0];
33237
+ const oo1 = Math.abs(other.Orientation[1]) > 179 ? Math.abs(other.Orientation[1]) : other.Orientation[1];
33238
+ const oo2 = Math.abs(other.Orientation[2]) > 179 ? Math.abs(other.Orientation[2]) : other.Orientation[2];
33239
+ return isSameFloat(this.Position[0], other.Position[0]) && isSameFloat(this.Position[1], other.Position[1]) && isSameFloat(this.Position[2], other.Position[2]) && isSameFloat(so0, oo0) && isSameFloat(so1, oo1) && isSameFloat(so2, oo2);
33233
33240
  }
33234
33241
  }
33235
33242
  class Connection {
@@ -44492,7 +44499,7 @@ function getOriginalSize(part) {
44492
44499
  }
44493
44500
  return originalSize;
44494
44501
  }
44495
- function scaleChildrenOfPart(part, scaleVector, alreadyScaledAttachment) {
44502
+ function scaleChildrenOfPart(part, scaleVector, adjustedScaleVector, alreadyScaledAttachment) {
44496
44503
  for (const child of part.GetDescendants()) {
44497
44504
  if (child.className === "Attachment" && child !== alreadyScaledAttachment) {
44498
44505
  let originalPosition = child.Prop("Position");
@@ -44503,7 +44510,7 @@ function scaleChildrenOfPart(part, scaleVector, alreadyScaledAttachment) {
44503
44510
  } else if (child.className === "SpecialMesh") {
44504
44511
  if (child.Prop("MeshType") !== MeshType.Head) {
44505
44512
  const orignalScale = child.Prop("Scale");
44506
- child.setProperty("Scale", orignalScale.multiply(scaleVector));
44513
+ child.setProperty("Scale", orignalScale.multiply(adjustedScaleVector));
44507
44514
  }
44508
44515
  }
44509
44516
  }
@@ -44632,7 +44639,7 @@ function ScaleAccessory(accessory, bodyScaleVector, headScaleVector, bodyTypeSca
44632
44639
  }
44633
44640
  }
44634
44641
  }
44635
- scaleChildrenOfPart(handle, beforeAdjustmentResultScale, hasAdjusted);
44642
+ scaleChildrenOfPart(handle, beforeAdjustmentResultScale, resultScale, hasAdjusted);
44636
44643
  handle.setProperty("Size", originalSize.multiply(resultScale));
44637
44644
  if (accessory.className === "Accessory") {
44638
44645
  const accessoryWrapper = new AccessoryWrapper(accessory);
@@ -64395,6 +64402,106 @@ async function generateOutfitModelThumbnail(auth, outfitModel, options) {
64395
64402
  Object.assign(defaultOptions, options);
64396
64403
  return generateOutfitThumbnail(auth, outfitModel, defaultOptions.size, defaultOptions.type, defaultOptions.quality, defaultOptions.gltfAutoDownload, defaultOptions.includeAnimations);
64397
64404
  }
64405
+ async function runTests() {
64406
+ const auth = new Authentication();
64407
+ const testModel = await API.Asset.GetRBX(FLAGS.AUTOTEST_MODEL);
64408
+ if (testModel instanceof Response) throw "FLAGS.AUTOTEST_MODEL request failed";
64409
+ const root = testModel.generateTree();
64410
+ const folder = root.Child("Tests");
64411
+ if (!folder) throw "FLAGS.AUTOTEST_MODEL is missing Tests folder";
64412
+ for (const test of folder.GetChildren()) {
64413
+ console.log(test);
64414
+ const outfitDataValue = test.Child("OutfitData");
64415
+ const typesValue = test.Child("Types");
64416
+ const avatar = test.Child("Player");
64417
+ if (!outfitDataValue || !typesValue || !avatar) throw "A test is missing OutfitData";
64418
+ const outfitData = outfitDataValue.Prop("Value");
64419
+ const types = typesValue.Prop("Value").split(",");
64420
+ const outfit = new Outfit();
64421
+ await outfit.fromBuffer(base64ToArrayBuffer(outfitData), auth);
64422
+ const outfitRenderer = new OutfitRenderer(auth, outfit);
64423
+ await new Promise((resolve) => {
64424
+ outfitRenderer.onSuccess.Connect(() => {
64425
+ for (const type of types) {
64426
+ switch (type) {
64427
+ case "scale":
64428
+ testScale(outfitRenderer, avatar);
64429
+ break;
64430
+ default:
64431
+ throw `Invalid test type found: ${type}`;
64432
+ }
64433
+ }
64434
+ resolve(null);
64435
+ });
64436
+ });
64437
+ outfitRenderer.onError.Connect(() => {
64438
+ throw "OutfitRenderer failed to load";
64439
+ });
64440
+ outfitRenderer.destroy();
64441
+ }
64442
+ console.log("TESTS COMPLETE!");
64443
+ }
64444
+ function getEquivalent(self2, otherParent) {
64445
+ const equivalent = otherParent.GetChildren().filter((v) => {
64446
+ return v.Prop("Name") === self2.Prop("Name") && v.className === self2.className;
64447
+ })[0];
64448
+ return equivalent;
64449
+ }
64450
+ function testScaleInstance(child, otherParent) {
64451
+ if (child.IsA("BasePart")) {
64452
+ const equivalent = getEquivalent(child, otherParent);
64453
+ if (!equivalent) throw `BasePart: No equivalent for ${child.GetFullName()}`;
64454
+ const equivalentSize = equivalent.Prop("size");
64455
+ const selfSize = child.Prop("size");
64456
+ if (!equivalentSize.isSame(selfSize)) throw `TEST FAIL: Part size for ${child.GetFullName()} is not the same`;
64457
+ const specialMesh = child.FindFirstChildOfClass("SpecialMesh");
64458
+ if (specialMesh) {
64459
+ testScaleInstance(specialMesh, equivalent);
64460
+ }
64461
+ const foundNames = [];
64462
+ for (const att of child.GetChildren()) {
64463
+ if (att.IsA("Attachment")) {
64464
+ foundNames.push(att.Prop("Name"));
64465
+ }
64466
+ }
64467
+ const newNames = foundNames.filter((v) => {
64468
+ return foundNames.filter((g) => {
64469
+ return g === v;
64470
+ }).length === 1;
64471
+ });
64472
+ for (const newName of newNames) {
64473
+ const att = child.Child(newName);
64474
+ if (!att) throw `Attachment somehow doesnt exist???`;
64475
+ testScaleInstance(att, equivalent);
64476
+ }
64477
+ } else if (child.IsA("Accessory")) {
64478
+ const equivalent = getEquivalent(child, otherParent);
64479
+ if (!equivalent) throw `Accessory: No equivalent for ${child.GetFullName()}`;
64480
+ const handle = child.Child("Handle");
64481
+ if (handle) {
64482
+ testScaleInstance(handle, equivalent);
64483
+ }
64484
+ } else if (child.className === "SpecialMesh") {
64485
+ const equivalent = getEquivalent(child, otherParent);
64486
+ if (!equivalent) throw `SpecialMesh: No equivalent for ${child.GetFullName()}`;
64487
+ const selfScale = child.Prop("Scale");
64488
+ const equivalentScale = equivalent.Prop("Scale");
64489
+ if (!selfScale.isSame(equivalentScale)) throw `TEST FAIL: SpecialMesh Scale for ${child.GetFullName()} is not the same`;
64490
+ } else if (child.IsA("Attachment")) {
64491
+ if (child.Prop("Name") === "RootRigAttachment") return;
64492
+ const equivalent = getEquivalent(child, otherParent);
64493
+ if (!equivalent) throw `Attachment: No equivalent for ${child.GetFullName()}`;
64494
+ const selfCF = child.Prop("CFrame");
64495
+ const equivalentCF = equivalent.Prop("CFrame");
64496
+ if (!selfCF.isSame(equivalentCF)) throw `TEST FAIL: Attachment CFrame for ${child.GetFullName()} is not the same`;
64497
+ }
64498
+ }
64499
+ function testScale(outfitRenderer, avatar) {
64500
+ const currentRig = outfitRenderer.currentRig;
64501
+ for (const child of currentRig.GetChildren()) {
64502
+ testScaleInstance(child, avatar);
64503
+ }
64504
+ }
64398
64505
  function renderToRenderTarget(width, height, renderScene) {
64399
64506
  const renderTarget = new WebGLRenderTarget(width, height, {
64400
64507
  colorSpace: SRGBColorSpace,
@@ -64476,6 +64583,9 @@ function exposeThumbnailGenerator() {
64476
64583
  globalThis.setupThumbnailScene = setupThumbnailScene;
64477
64584
  globalThis.getThumbnailCameraCFrame = getThumbnailCameraCFrame;
64478
64585
  }
64586
+ function exposeTests() {
64587
+ globalThis.runTests = runTests;
64588
+ }
64479
64589
  export {
64480
64590
  API,
64481
64591
  AbbreviationToFaceControlProperty,
@@ -64684,6 +64794,7 @@ export {
64684
64794
  exposeAPI,
64685
64795
  exposeFLAGS,
64686
64796
  exposeMesh,
64797
+ exposeTests,
64687
64798
  exposeThumbnailGenerator,
64688
64799
  fileMeshToTHREEGeometry,
64689
64800
  floor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",