roavatar-renderer 1.5.7 → 1.5.9

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.js CHANGED
@@ -29099,77 +29099,35 @@ function inheritUV(to, from) {
29099
29099
  }
29100
29100
  }
29101
29101
  function transferSkeleton(to, from) {
29102
- if (from.skinning.skinnings.length < 1) {
29102
+ if (from.skinning.numskinnings < 1) {
29103
29103
  warn(false, `From mesh has no skeleton that can be inherited`);
29104
29104
  return;
29105
29105
  }
29106
29106
  to.skinning = from.skinning.clone();
29107
- to.skinning.numSkinnings = to.coreMesh.numverts;
29108
- to.skinning.skinnings = new Array(to.skinning.numSkinnings);
29107
+ to.skinning.numskinnings = to.coreMesh.numverts;
29109
29108
  const distIndexArr = getDistIndexArray(to, from);
29110
- const newSkinDatas = new Array(to.coreMesh.numverts);
29111
29109
  for (let i = 0; i < to.coreMesh.numverts; i++) {
29112
29110
  let closestI = distIndexArr[i];
29113
29111
  if (closestI === void 0) {
29114
29112
  warn(false, "did not find matching vert during transfer");
29115
29113
  closestI = 0;
29116
29114
  }
29117
- const closestSkinning = from.skinning.skinnings[closestI];
29118
- const closestSubsetIndex = from.skinning.getSubsetIndex(closestI);
29119
- newSkinDatas[i] = [closestSubsetIndex, closestSkinning, i];
29115
+ const closestSkinning = closestI;
29116
+ to.skinning.setIndex(i, from.skinning.getIndex(closestSkinning));
29117
+ to.skinning.setWeight(i, from.skinning.getWeight(closestSkinning));
29120
29118
  }
29121
- newSkinDatas.sort((a, b) => {
29122
- return a[0] - b[0];
29123
- });
29124
- const newSubsets = [];
29125
- const newVerts = [];
29126
- const newSkinnings = [];
29127
- const toSubsetToFromSubsetMap = /* @__PURE__ */ new Map();
29128
- for (let i = 0; i < newSkinDatas.length; i++) {
29129
- const newSkinData = newSkinDatas[i];
29130
- const currentSubset = newSubsets[newSubsets.length - 1];
29131
- const vertSubset = from.skinning.subsets[newSkinData[0]];
29132
- const skinning = newSkinData[1].clone();
29133
- if (toSubsetToFromSubsetMap.get(currentSubset) !== vertSubset) {
29134
- const toPush = vertSubset.clone();
29135
- newSubsets.push(toPush);
29136
- toSubsetToFromSubsetMap.set(toPush, vertSubset);
29137
- toPush.vertsBegin = i;
29138
- toPush.vertsLength = 1;
29139
- } else {
29140
- currentSubset.vertsLength += 1;
29141
- }
29142
- newVerts.push(newSkinData[2]);
29143
- newSkinnings.push(skinning);
29144
- }
29145
- for (let i = 0; i < to.coreMesh.numfaces; i++) {
29146
- const face = to.coreMesh.getFace(i);
29147
- to.coreMesh.setFace(i, [
29148
- newVerts.indexOf(face[0]),
29149
- newVerts.indexOf(face[1]),
29150
- newVerts.indexOf(face[2])
29151
- ]);
29152
- }
29153
- to.coreMesh.onlyVerts(newVerts);
29154
- to.skinning.subsets = [];
29155
- for (const subset of newSubsets) {
29156
- to.skinning.subsets.push(subset.clone());
29157
- }
29158
- to.skinning.skinnings = newSkinnings;
29159
29119
  if (from.facs) {
29160
29120
  to.facs = from.facs.clone();
29161
29121
  }
29162
29122
  }
29163
29123
  function inheritSkeleton(to, from) {
29164
- if (from.skinning.skinnings.length < 1) {
29124
+ if (from.skinning.numskinnings < 1) {
29165
29125
  warn(false, `From mesh has no skeleton that can be inherited`);
29166
29126
  return;
29167
29127
  }
29168
29128
  to.skinning = from.skinning.clone();
29169
- to.skinning.numSkinnings = to.coreMesh.numverts;
29170
- to.skinning.skinnings = new Array(to.skinning.numSkinnings);
29129
+ to.skinning.numskinnings = to.coreMesh.numverts;
29171
29130
  const vertKD = buildVertKD(from);
29172
- const newSkinDatas = new Array(to.coreMesh.numverts);
29173
29131
  for (let i = 0; i < to.coreMesh.numverts; i++) {
29174
29132
  let normal = to.coreMesh.getNormal(i);
29175
29133
  if (isNaN(normal[0]) || isNaN(normal[1]) || isNaN(normal[2])) {
@@ -29179,49 +29137,10 @@ function inheritSkeleton(to, from) {
29179
29137
  const toSearch = minus(toVertPos, multiply(normal, [0, 0, 0]));
29180
29138
  const closest = nearestSearch(vertKD, toSearch);
29181
29139
  const closestI = closest.index;
29182
- const closestSkinning = from.skinning.skinnings[closestI];
29183
- const closestSubsetIndex = from.skinning.getSubsetIndex(closestI);
29184
- newSkinDatas[i] = [closestSubsetIndex, closestSkinning, i];
29185
- }
29186
- newSkinDatas.sort((a, b) => {
29187
- return a[0] - b[0];
29188
- });
29189
- const newSubsets = [];
29190
- const newVerts = [];
29191
- const newSkinnings = [];
29192
- const toSubsetToFromSubsetMap = /* @__PURE__ */ new Map();
29193
- for (let i = 0; i < newSkinDatas.length; i++) {
29194
- const newSkinData = newSkinDatas[i];
29195
- const currentSubset = newSubsets[newSubsets.length - 1];
29196
- const vertSubset = from.skinning.subsets[newSkinData[0]];
29197
- const toVertIndex = newSkinData[2];
29198
- const skinning = newSkinData[1].clone();
29199
- if (toSubsetToFromSubsetMap.get(currentSubset) !== vertSubset) {
29200
- const toPush = vertSubset.clone();
29201
- newSubsets.push(toPush);
29202
- toSubsetToFromSubsetMap.set(toPush, vertSubset);
29203
- toPush.vertsBegin = i;
29204
- toPush.vertsLength = 1;
29205
- } else {
29206
- currentSubset.vertsLength += 1;
29207
- }
29208
- newVerts.push(toVertIndex);
29209
- newSkinnings.push(skinning);
29210
- }
29211
- for (let i = 0; i < to.coreMesh.numfaces; i++) {
29212
- const face = to.coreMesh.getFace(i);
29213
- to.coreMesh.setFace(i, [
29214
- newVerts.indexOf(face[0]),
29215
- newVerts.indexOf(face[1]),
29216
- newVerts.indexOf(face[2])
29217
- ]);
29218
- }
29219
- to.coreMesh.onlyVerts(newVerts);
29220
- to.skinning.subsets = [];
29221
- for (const subset of newSubsets) {
29222
- to.skinning.subsets.push(subset.clone());
29140
+ const closestSkinning = closestI;
29141
+ to.skinning.setIndex(i, from.skinning.getIndex(closestSkinning));
29142
+ to.skinning.setWeight(i, from.skinning.getWeight(closestSkinning));
29223
29143
  }
29224
- to.skinning.skinnings = newSkinnings;
29225
29144
  if (from.facs) {
29226
29145
  to.facs = from.facs.clone();
29227
29146
  }
@@ -29264,6 +29183,7 @@ function offsetMesh(mesh, cframe) {
29264
29183
  }
29265
29184
  for (const bone of mesh.skinning.bones) {
29266
29185
  bone.position = add(bone.position, cframe.Position);
29186
+ bone.sourceOffset.Position = add(bone.sourceOffset.Position, cframe.Position);
29267
29187
  }
29268
29188
  }
29269
29189
  function scaleMesh(mesh, scale) {
@@ -29272,6 +29192,7 @@ function scaleMesh(mesh, scale) {
29272
29192
  }
29273
29193
  for (const bone of mesh.skinning.bones) {
29274
29194
  bone.position = new Vector32().fromVec3(bone.position).multiply(scale).toVec3();
29195
+ bone.sourceScaled = multiply(bone.sourceScaled, scale.toVec3());
29275
29196
  }
29276
29197
  }
29277
29198
  function offsetMeshWithRotation(mesh, cframe) {
@@ -29282,6 +29203,7 @@ function offsetMeshWithRotation(mesh, cframe) {
29282
29203
  for (const bone of mesh.skinning.bones) {
29283
29204
  const boneCF = new CFrame(...bone.position);
29284
29205
  bone.position = cframe.multiply(boneCF).Position;
29206
+ bone.sourceOffset = cframe.multiply(bone.sourceOffset);
29285
29207
  }
29286
29208
  }
29287
29209
  function getOffsetArray(inner, outer) {
@@ -29892,6 +29814,8 @@ const FLAGS = {
29892
29814
  //dom
29893
29815
  AVATAR_JOINT_UPGRADE: false,
29894
29816
  INSTANCE_GARBAGE_COLLECT: false,
29817
+ LEGACY_WELD_BEHAVIOR: false,
29818
+ USE_ASSEMBLY: true,
29895
29819
  //api
29896
29820
  BODYCOLOR3: true,
29897
29821
  ENABLE_API_CACHE: true,
@@ -29906,6 +29830,7 @@ const FLAGS = {
29906
29830
  API_REQUEST_PREFIX: "",
29907
29831
  INCLUDE_REQUEST_CREDENTIALS_OVERRIDE: "include",
29908
29832
  API_REQUEST_RETRY: true,
29833
+ FETCH_FUNC: void 0,
29909
29834
  //assets
29910
29835
  ONLINE_ASSETS: false,
29911
29836
  ASSETS_PATH: "../assets/rbxasset/",
@@ -29933,7 +29858,6 @@ const FLAGS = {
29933
29858
  //does this count as anti aliasing?
29934
29859
  GEAR_ENABLED: true,
29935
29860
  AUDIO_ENABLED: true,
29936
- LEGACY_WELD_BEHAVIOR: false,
29937
29861
  USE_RENDERTARGET: true,
29938
29862
  AUTO_RESTORE_CONTEXT: true,
29939
29863
  RENDERTARGET_TO_CANVASTEXTURE: false,
@@ -29941,6 +29865,7 @@ const FLAGS = {
29941
29865
  ALWAYS_SHOW_ATTACHMENTS: false,
29942
29866
  //skeleton
29943
29867
  SHOW_SKELETON_HELPER: false,
29868
+ SKELETON_HELPER_INSTANCE_NAME: void 0,
29944
29869
  UPDATE_SKELETON: true,
29945
29870
  ANIMATE_SKELETON: true,
29946
29871
  AUTO_SKIN_EVERYTHING: false,
@@ -30001,10 +29926,12 @@ class InstanceWrapper {
30001
29926
  if (this.instance.className !== this.static().className) {
30002
29927
  throw new Error(`Provided Instance is not a ${this.static().className}`);
30003
29928
  }
29929
+ if (this.instance.wrapperInitialized) return;
30004
29930
  const propertyNames = this.instance.getPropertyNames();
30005
29931
  const hasAllProperties = this.static().requiredProperties.every((value) => propertyNames.includes(value));
30006
29932
  if (!hasAllProperties) {
30007
29933
  this.setup();
29934
+ this.instance.wrapperInitialized = true;
30008
29935
  const newPropertyNames = this.instance.getPropertyNames();
30009
29936
  const hasAllProperties2 = this.static().requiredProperties.every((value) => newPropertyNames.includes(value));
30010
29937
  if (!hasAllProperties2) {
@@ -30052,7 +29979,7 @@ class InstanceWrapper {
30052
29979
  preRender() {
30053
29980
  }
30054
29981
  }
30055
- const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29982
+ const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30056
29983
  __proto__: null,
30057
29984
  GetWrapperForInstance,
30058
29985
  InstanceWrapper
@@ -30541,6 +30468,7 @@ class Instance {
30541
30468
  parent = void 0;
30542
30469
  destroyed = false;
30543
30470
  _hasWrappered = false;
30471
+ wrapperInitialized = false;
30544
30472
  //private _canGC: boolean = true
30545
30473
  classID;
30546
30474
  //dont use this to identify instance class, it is only used during file loading
@@ -30551,6 +30479,7 @@ class Instance {
30551
30479
  Destroying = new Event();
30552
30480
  Changed = new Event();
30553
30481
  AncestryChanged = new Event();
30482
+ referencedByChanged = new Event();
30554
30483
  constructor(className, notComplete = false) {
30555
30484
  this._id = lastInstanceId;
30556
30485
  lastInstanceId++;
@@ -30600,6 +30529,7 @@ class Instance {
30600
30529
  if (!this._referencedBy.includes(instance)) {
30601
30530
  this._referencedBy.push(instance);
30602
30531
  }
30532
+ this.referencedByChanged.Fire();
30603
30533
  }
30604
30534
  removeReferencedBy(instance) {
30605
30535
  const index = this._referencedBy.indexOf(instance);
@@ -30613,9 +30543,13 @@ class Instance {
30613
30543
  }
30614
30544
  if (!isReferenced) {
30615
30545
  this._referencedBy.splice(index, 1);
30546
+ this.referencedByChanged.Fire();
30616
30547
  }
30617
30548
  }
30618
30549
  }
30550
+ getReferencedBy() {
30551
+ return [...this._referencedBy];
30552
+ }
30619
30553
  addProperty(property, value) {
30620
30554
  if (!property.name) {
30621
30555
  error(property);
@@ -30676,7 +30610,7 @@ class Instance {
30676
30610
  }
30677
30611
  if (FLAGS.SEARCH_FOR_STRING) {
30678
30612
  if (property.typeID === DataType.String || property.typeID === DataType.Bytecode || property.typeID === DataType.SharedString) {
30679
- if (value.toLowerCase().includes(FLAGS.SEARCH_FOR_STRING)) {
30613
+ if (value && value.toLowerCase().includes(FLAGS.SEARCH_FOR_STRING)) {
30680
30614
  log(true, this.GetFullName());
30681
30615
  log(true, value);
30682
30616
  }
@@ -30788,6 +30722,7 @@ class Instance {
30788
30722
  this.parent = instance;
30789
30723
  if (originalParent && originalParent !== instance) {
30790
30724
  originalParent.ChildRemoved.Fire(this);
30725
+ originalParent.AncestryChanged.Fire(this);
30791
30726
  }
30792
30727
  if (instance) {
30793
30728
  instance._children.push(this);
@@ -30811,6 +30746,7 @@ class Instance {
30811
30746
  this.Destroying.Clear();
30812
30747
  this.Changed.Clear();
30813
30748
  this.AncestryChanged.Clear();
30749
+ this.referencedByChanged.Clear();
30814
30750
  this.setParent(null);
30815
30751
  for (const child of this.GetChildren()) {
30816
30752
  child.Destroy();
@@ -30818,7 +30754,7 @@ class Instance {
30818
30754
  for (const property of this.getPropertyNames()) {
30819
30755
  this.setProperty(property, null);
30820
30756
  }
30821
- for (const instance of this._referencedBy) {
30757
+ for (const instance of this.getReferencedBy()) {
30822
30758
  for (const propertyName of instance.getPropertyNames()) {
30823
30759
  if (instance.Property(propertyName) === this) {
30824
30760
  instance.setProperty(propertyName, null);
@@ -30892,6 +30828,13 @@ class Instance {
30892
30828
  }
30893
30829
  return lastChild;
30894
30830
  }
30831
+ IsA(className) {
30832
+ const wrapper = this.w;
30833
+ if (wrapper) {
30834
+ return wrapper.IsA(className);
30835
+ }
30836
+ return false;
30837
+ }
30895
30838
  preRender() {
30896
30839
  const wrapper = GetWrapperForInstance(this);
30897
30840
  if (wrapper) {
@@ -31402,7 +31345,7 @@ class RBX {
31402
31345
  case "Content": {
31403
31346
  const property = new Property();
31404
31347
  property.name = propertyNode.getAttribute("name") || "null";
31405
- property.typeID = DataType.String;
31348
+ property.typeID = DataType.Content;
31406
31349
  instance.addProperty(property);
31407
31350
  const childElement = propertyNode.querySelector(":scope > *");
31408
31351
  if (childElement) {
@@ -31427,7 +31370,7 @@ class RBX {
31427
31370
  case "bool": {
31428
31371
  const property = new Property();
31429
31372
  property.name = propertyNode.getAttribute("name") || "null";
31430
- property.typeID = DataType.String;
31373
+ property.typeID = DataType.Bool;
31431
31374
  instance.addProperty(property);
31432
31375
  instance.setProperty(property.name, propertyNode.textContent.toLowerCase() === "true");
31433
31376
  break;
@@ -31581,7 +31524,7 @@ class RBX {
31581
31524
  case "NumberSequence": {
31582
31525
  const property = new Property();
31583
31526
  property.name = propertyNode.getAttribute("name") || "null";
31584
- property.typeID = DataType.NumberRange;
31527
+ property.typeID = DataType.NumberSequence;
31585
31528
  const values = propertyNode.textContent.split(" ");
31586
31529
  const numberSequence = new NumberSequence();
31587
31530
  for (let i = 0; i < Math.floor(values.length / 3); i++) {
@@ -31598,7 +31541,7 @@ class RBX {
31598
31541
  case "ColorSequence": {
31599
31542
  const property = new Property();
31600
31543
  property.name = propertyNode.getAttribute("name") || "null";
31601
- property.typeID = DataType.NumberRange;
31544
+ property.typeID = DataType.ColorSequence;
31602
31545
  const values = propertyNode.textContent.split(" ");
31603
31546
  const colorSequence = new ColorSequence();
31604
31547
  for (let i = 0; i < Math.floor(values.length / 5); i++) {
@@ -32274,8 +32217,8 @@ const AssetTypes = [
32274
32217
  "Audio",
32275
32218
  "Mesh",
32276
32219
  "Lua",
32277
- "",
32278
- "",
32220
+ "HTML",
32221
+ "Text",
32279
32222
  "Hat",
32280
32223
  "Place",
32281
32224
  "Model",
@@ -32284,30 +32227,30 @@ const AssetTypes = [
32284
32227
  "Decal",
32285
32228
  "",
32286
32229
  "",
32287
- "",
32230
+ "Avatar",
32288
32231
  "Head",
32289
32232
  "Face",
32290
32233
  "Gear",
32291
32234
  "",
32292
32235
  "Badge",
32293
- "",
32236
+ "GroupEmblem",
32294
32237
  "",
32295
32238
  "Animation",
32296
- "",
32297
- "",
32239
+ "Arms",
32240
+ "Legs",
32298
32241
  "Torso",
32299
32242
  "RightArm",
32300
32243
  "LeftArm",
32301
32244
  "LeftLeg",
32302
32245
  "RightLeg",
32303
32246
  "Package",
32304
- "",
32247
+ "YouTubeVideo",
32305
32248
  "GamePass",
32249
+ "App",
32306
32250
  "",
32307
- "",
32308
- "",
32251
+ "Code",
32309
32252
  "Plugin",
32310
- "",
32253
+ "SolidModel",
32311
32254
  "MeshPart",
32312
32255
  "HairAccessory",
32313
32256
  "FaceAccessory",
@@ -32325,13 +32268,13 @@ const AssetTypes = [
32325
32268
  "SwimAnimation",
32326
32269
  "WalkAnimation",
32327
32270
  "PoseAnimation",
32328
- "EarAccessory",
32329
- "EyeAccessory",
32330
32271
  "",
32331
32272
  "",
32273
+ "LocalizationTableManifest",
32274
+ "LocalizationTableTranslation",
32332
32275
  "EmoteAnimation",
32333
32276
  "Video",
32334
- "",
32277
+ "TexturePack",
32335
32278
  "TShirtAccessory",
32336
32279
  "ShirtAccessory",
32337
32280
  "PantsAccessory",
@@ -32342,24 +32285,26 @@ const AssetTypes = [
32342
32285
  "RightShoeAccessory",
32343
32286
  "DressSkirtAccessory",
32344
32287
  "FontFamily",
32345
- "",
32346
- "",
32288
+ "FontFace",
32289
+ "MeshHiddenSurfaceRemoval",
32347
32290
  "EyebrowAccessory",
32348
32291
  "EyelashAccessory",
32349
32292
  "MoodAnimation",
32350
32293
  "DynamicHead",
32351
32294
  //79
32352
- "",
32353
- "",
32354
- "",
32355
- "",
32356
- "",
32357
- "",
32358
- "",
32359
- "",
32295
+ "CodeSnippet",
32296
+ "AdsVideo",
32297
+ "OtaUpdate",
32298
+ "Screenshot",
32299
+ "RuntimePropertySet",
32300
+ "StorePreviewVideo",
32301
+ "GamePreviewVideo",
32302
+ "CreatorExperienceConfig",
32360
32303
  "FaceMakeup",
32361
32304
  "LipMakeup",
32362
- "EyeMakeup"
32305
+ "EyeMakeup",
32306
+ "VoxelFragment",
32307
+ "AvatarBackground"
32363
32308
  ];
32364
32309
  const WearableAssetTypes = [
32365
32310
  "TShirt",
@@ -34548,6 +34493,7 @@ class HSRAVIS {
34548
34493
  }
34549
34494
  }
34550
34495
  class FileMeshBone {
34496
+ name;
34551
34497
  boneNameIndex = 0;
34552
34498
  //uint
34553
34499
  parentIndex = 0;
@@ -34559,14 +34505,24 @@ class FileMeshBone {
34559
34505
  rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
34560
34506
  //3x3, world space, y up, -z forward
34561
34507
  position = [0, 0, 0];
34508
+ //metadata so skeletondesc knows what autoskin has done
34509
+ sourcePart;
34510
+ sourceOffset = new CFrame();
34511
+ sourceSize;
34512
+ sourceScaled = [1, 1, 1];
34562
34513
  clone() {
34563
34514
  const copy = new FileMeshBone();
34515
+ copy.name = this.name;
34564
34516
  copy.boneNameIndex = this.boneNameIndex;
34565
34517
  copy.parentIndex = this.parentIndex;
34566
34518
  copy.lodParentIndex = this.lodParentIndex;
34567
34519
  copy.culling = this.culling;
34568
34520
  copy.rotationMatrix = clonePrimitiveArray(this.rotationMatrix);
34569
34521
  copy.position = clonePrimitiveArray(this.position);
34522
+ copy.sourcePart = this.sourcePart;
34523
+ copy.sourceOffset = this.sourceOffset.clone();
34524
+ if (this.sourceSize) copy.sourceSize = clonePrimitiveArray(this.sourceSize);
34525
+ copy.sourceScaled = clonePrimitiveArray(this.sourceScaled);
34570
34526
  return copy;
34571
34527
  }
34572
34528
  }
@@ -34594,71 +34550,105 @@ class FileMeshSubset {
34594
34550
  return copy;
34595
34551
  }
34596
34552
  }
34597
- class FileMeshSkinning {
34598
- subsetIndices = [0, 0, 0, 0];
34599
- //byte[4]
34600
- boneWeights = [0, 0, 0, 0];
34601
- //byte[4]
34602
- clone() {
34603
- const copy = new FileMeshSkinning();
34604
- copy.subsetIndices = clonePrimitiveArray(this.subsetIndices);
34605
- copy.boneWeights = clonePrimitiveArray(this.boneWeights);
34606
- return copy;
34607
- }
34608
- }
34609
34553
  class SKINNING {
34610
- numSkinnings = 0;
34611
- //uint (same as numVerts)
34612
- skinnings = [];
34613
- //TODO: check if its actually here in the chunk format, im assuming MaximumADHD forgot to note it down because its not always present OR it was merged with vertices
34614
- numBones = 0;
34615
- //uint
34554
+ _numskinnings = 0;
34555
+ _indices = new Uint16Array();
34556
+ _weights = new Float32Array();
34616
34557
  bones = [];
34617
- //FileMeshBone[]
34618
- nameTableSize = 0;
34619
- //uint
34620
- nameTable = [];
34621
- //string[]
34622
- numSubsets = 0;
34623
- //uint
34624
- subsets = [];
34625
- //FileMeshSubset[]
34626
34558
  clone() {
34627
34559
  const copy = new SKINNING();
34628
- copy.numSkinnings = this.numSkinnings;
34629
- copy.skinnings = new Array(this.skinnings.length);
34630
- for (let i = 0; i < this.skinnings.length; i++) {
34631
- copy.skinnings[i] = this.skinnings[i].clone();
34632
- }
34633
- copy.numBones = this.numBones;
34560
+ copy._numskinnings = this._numskinnings;
34561
+ copy._indices = this._indices.slice();
34562
+ copy._weights = this._weights.slice();
34634
34563
  copy.bones = new Array(this.bones.length);
34635
34564
  for (let i = 0; i < this.bones.length; i++) {
34636
34565
  copy.bones[i] = this.bones[i].clone();
34637
34566
  }
34638
- copy.nameTableSize = this.nameTableSize;
34639
- copy.nameTable = clonePrimitiveArray(this.nameTable);
34640
- copy.numSubsets = this.numSubsets;
34641
- copy.subsets = new Array(this.subsets.length);
34642
- for (let i = 0; i < this.subsets.length; i++) {
34643
- copy.subsets[i] = this.subsets[i].clone();
34644
- }
34645
34567
  return copy;
34646
34568
  }
34647
- getBone(boneName) {
34648
- const boneIndex = this.nameTable.indexOf(boneName);
34649
- if (boneIndex > -1) {
34650
- return this.bones[boneIndex];
34569
+ get numskinnings() {
34570
+ return this._numskinnings;
34571
+ }
34572
+ set numskinnings(value) {
34573
+ this._numskinnings = value;
34574
+ this._indices = new Uint16Array(value * 4);
34575
+ this._weights = new Float32Array(value * 4);
34576
+ }
34577
+ get indices() {
34578
+ return this._indices;
34579
+ }
34580
+ get weights() {
34581
+ return this._weights;
34582
+ }
34583
+ getIndex(i) {
34584
+ return [
34585
+ this._indices[i * 4 + 0],
34586
+ this._indices[i * 4 + 1],
34587
+ this._indices[i * 4 + 2],
34588
+ this._indices[i * 4 + 3]
34589
+ ];
34590
+ }
34591
+ setIndex(i, value) {
34592
+ this._indices[i * 4 + 0] = value[0];
34593
+ this._indices[i * 4 + 1] = value[1];
34594
+ this._indices[i * 4 + 2] = value[2];
34595
+ this._indices[i * 4 + 3] = value[3];
34596
+ }
34597
+ getWeight(i) {
34598
+ return [
34599
+ this._weights[i * 4 + 0],
34600
+ this._weights[i * 4 + 1],
34601
+ this._weights[i * 4 + 2],
34602
+ this._weights[i * 4 + 3]
34603
+ ];
34604
+ }
34605
+ setWeight(i, value) {
34606
+ this._weights[i * 4 + 0] = value[0];
34607
+ this._weights[i * 4 + 1] = value[1];
34608
+ this._weights[i * 4 + 2] = value[2];
34609
+ this._weights[i * 4 + 3] = value[3];
34610
+ }
34611
+ readSkinning(view, i) {
34612
+ this.setIndex(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34613
+ this.setWeight(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34614
+ }
34615
+ increaseSkinnings(add2) {
34616
+ const newSize = this.numskinnings + add2;
34617
+ const ogIndices = this._indices;
34618
+ const ogWeights = this._weights;
34619
+ this.numskinnings = newSize;
34620
+ this._indices.set(ogIndices);
34621
+ this._weights.set(ogWeights);
34622
+ }
34623
+ onlySkinnings(only) {
34624
+ const newSize = only.length;
34625
+ const ogIndices = this._indices;
34626
+ const ogWeights = this._weights;
34627
+ this.numskinnings = newSize;
34628
+ for (let i = 0; i < only.length; i++) {
34629
+ const j = only[i];
34630
+ const ogIndex = [
34631
+ ogIndices[j * 4 + 0],
34632
+ ogIndices[j * 4 + 1],
34633
+ ogIndices[j * 4 + 2],
34634
+ ogIndices[j * 4 + 3]
34635
+ ];
34636
+ const ogWeight = [
34637
+ ogWeights[j * 4 + 0],
34638
+ ogWeights[j * 4 + 1],
34639
+ ogWeights[j * 4 + 2],
34640
+ ogWeights[j * 4 + 3]
34641
+ ];
34642
+ this.setIndex(i, ogIndex);
34643
+ this.setWeight(i, ogWeight);
34651
34644
  }
34652
34645
  }
34653
- getSubsetIndex(vertIndex) {
34654
- for (let i = 0; i < this.subsets.length; i++) {
34655
- const subset = this.subsets[i];
34656
- if (subset.vertsBegin <= vertIndex && vertIndex < subset.vertsBegin + subset.vertsLength) {
34657
- return i;
34646
+ getBone(name) {
34647
+ for (const bone of this.bones) {
34648
+ if (bone.name === name) {
34649
+ return bone;
34658
34650
  }
34659
34651
  }
34660
- error(this);
34661
- throw new Error(`There is no subset for vert index ${vertIndex}`);
34662
34652
  }
34663
34653
  }
34664
34654
  class QuantizedMatrix {
@@ -34755,12 +34745,6 @@ function readBone(view) {
34755
34745
  bone.position = [view.readFloat32(), view.readFloat32(), view.readFloat32()];
34756
34746
  return bone;
34757
34747
  }
34758
- function readSkinning(view) {
34759
- const skinning = new FileMeshSkinning();
34760
- skinning.subsetIndices = [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()];
34761
- skinning.boneWeights = [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()];
34762
- return skinning;
34763
- }
34764
34748
  function readQuantizedMatrix(view) {
34765
34749
  const version = view.readUint16();
34766
34750
  const rows = view.readUint32();
@@ -34984,28 +34968,46 @@ class FileMesh {
34984
34968
  }
34985
34969
  readChunkSKINNING(view, version) {
34986
34970
  if (version !== 1) return;
34987
- this.skinning.numSkinnings = view.readUint32();
34988
- for (let i = 0; i < this.skinning.numSkinnings; i++) {
34989
- this.skinning.skinnings.push(readSkinning(view));
34971
+ this.skinning.numskinnings = view.readUint32();
34972
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
34973
+ this.skinning.readSkinning(view, i);
34990
34974
  }
34991
- this.skinning.numBones = view.readUint32();
34992
- for (let i = 0; i < this.skinning.numBones; i++) {
34975
+ const numBones = view.readUint32();
34976
+ for (let i = 0; i < numBones; i++) {
34993
34977
  this.skinning.bones.push(readBone(view));
34994
34978
  }
34995
- this.skinning.nameTableSize = view.readUint32();
34979
+ const nameTableSize = view.readUint32();
34980
+ const nameTable = [];
34981
+ const nameTableIndex = [];
34996
34982
  let lastString = "";
34997
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
34983
+ for (let i = 0; i < nameTableSize; i++) {
34998
34984
  if (view.readUint8() !== 0) {
34999
34985
  view.viewOffset--;
35000
34986
  lastString += view.readUtf8String(1);
35001
34987
  } else {
35002
- this.skinning.nameTable.push(lastString);
34988
+ nameTable.push(lastString);
34989
+ nameTableIndex.push(i - lastString.length);
35003
34990
  lastString = "";
35004
34991
  }
35005
34992
  }
35006
- this.skinning.numSubsets = view.readUint32();
35007
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35008
- this.skinning.subsets.push(readSubset(view));
34993
+ for (const bone of this.skinning.bones) {
34994
+ for (let i = 0; i < nameTable.length; i++) {
34995
+ if (nameTableIndex[i] === bone.boneNameIndex) {
34996
+ bone.name = nameTable[i];
34997
+ break;
34998
+ }
34999
+ }
35000
+ }
35001
+ const numSubsets = view.readUint32();
35002
+ for (let i = 0; i < numSubsets; i++) {
35003
+ const subset = readSubset(view);
35004
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35005
+ const indices = this.skinning.getIndex(i2);
35006
+ const newIndices = indices.map((v) => {
35007
+ return subset.boneIndices[v];
35008
+ });
35009
+ this.skinning.setIndex(i2, newIndices);
35010
+ }
35009
35011
  }
35010
35012
  }
35011
35013
  readChunkHSRAVIS(view, version) {
@@ -35199,9 +35201,9 @@ class FileMesh {
35199
35201
  this.coreMesh.numverts = view.readUint32();
35200
35202
  this.coreMesh.numfaces = view.readUint32();
35201
35203
  this.lods.numLodOffsets = view.readUint16();
35202
- this.skinning.numBones = view.readUint16();
35203
- this.skinning.nameTableSize = view.readUint32();
35204
- this.skinning.numSubsets = view.readUint16();
35204
+ const numBones = view.readUint16();
35205
+ const nameTableSize = view.readUint32();
35206
+ const numSubsets = view.readUint16();
35205
35207
  this.lods.numHighQualityLODs = view.readInt8();
35206
35208
  view.readInt8();
35207
35209
  if (version === "version 5.00\n") {
@@ -35211,9 +35213,10 @@ class FileMesh {
35211
35213
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35212
35214
  this.coreMesh.readVert(i, view);
35213
35215
  }
35214
- if (this.skinning.numBones > 0) {
35215
- for (let i = 0; i < this.coreMesh.numverts; i++) {
35216
- this.skinning.skinnings.push(readSkinning(view));
35216
+ if (numBones > 0) {
35217
+ this.skinning.numskinnings = this.coreMesh.numverts;
35218
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
35219
+ this.skinning.readSkinning(view, i);
35217
35220
  }
35218
35221
  }
35219
35222
  for (let i = 0; i < this.coreMesh.numfaces; i++) {
@@ -35222,21 +35225,39 @@ class FileMesh {
35222
35225
  for (let i = 0; i < this.lods.numLodOffsets; i++) {
35223
35226
  this.lods.lodOffsets.push(view.readUint32());
35224
35227
  }
35225
- for (let i = 0; i < this.skinning.numBones; i++) {
35228
+ for (let i = 0; i < numBones; i++) {
35226
35229
  this.skinning.bones.push(readBone(view));
35227
35230
  }
35231
+ const nameTable = [];
35232
+ const nameTableIndex = [];
35228
35233
  let lastString = "";
35229
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
35234
+ for (let i = 0; i < nameTableSize; i++) {
35230
35235
  if (view.readUint8() !== 0) {
35231
35236
  view.viewOffset--;
35232
35237
  lastString += view.readUtf8String(1);
35233
35238
  } else {
35234
- this.skinning.nameTable.push(lastString);
35239
+ nameTable.push(lastString);
35240
+ nameTableIndex.push(i - lastString.length);
35235
35241
  lastString = "";
35236
35242
  }
35237
35243
  }
35238
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35239
- this.skinning.subsets.push(readSubset(view));
35244
+ for (const bone of this.skinning.bones) {
35245
+ for (let i = 0; i < nameTable.length; i++) {
35246
+ if (nameTableIndex[i] === bone.boneNameIndex) {
35247
+ bone.name = nameTable[i];
35248
+ break;
35249
+ }
35250
+ }
35251
+ }
35252
+ for (let i = 0; i < numSubsets; i++) {
35253
+ const subset = readSubset(view);
35254
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35255
+ const indices = this.skinning.getIndex(i2);
35256
+ const newIndices = indices.map((v) => {
35257
+ return subset.boneIndices[v];
35258
+ });
35259
+ this.skinning.setIndex(i2, newIndices);
35260
+ }
35240
35261
  }
35241
35262
  if (version === "version 5.00\n" && this.facsDataFormat === 1 && this.sizeOfFacsData > 0) {
35242
35263
  this.facs = readFACS(view);
@@ -35257,6 +35278,9 @@ class FileMesh {
35257
35278
  warn(true, `Issue with parsed mesh: ${issue}`);
35258
35279
  }
35259
35280
  log(false, `Bytes left: ${view.view.byteLength - view.viewOffset}`);
35281
+ if (this.skinning.numskinnings > 0) {
35282
+ log(false, this.skinning);
35283
+ }
35260
35284
  }
35261
35285
  stripLODS() {
35262
35286
  let facesEnd = this.coreMesh.numfaces;
@@ -35275,28 +35299,16 @@ class FileMesh {
35275
35299
  }
35276
35300
  padSkinnings() {
35277
35301
  const vertsLength = this.coreMesh.numverts;
35278
- const skinningsLength = this.skinning.skinnings.length;
35302
+ const skinningsLength = this.skinning.numskinnings;
35279
35303
  const missingCount = vertsLength - skinningsLength;
35280
- for (let i = 0; i < missingCount; i++) {
35281
- this.skinning.skinnings.push(new FileMeshSkinning());
35282
- }
35283
- if (this.skinning.subsets.length === 0) {
35284
- const subset = new FileMeshSubset();
35285
- subset.boneIndices = new Array(26).fill(65535);
35286
- subset.boneIndices[0] = 0;
35287
- subset.vertsBegin = 0;
35288
- subset.vertsLength = this.coreMesh.numverts;
35289
- subset.facesBegin = 0;
35290
- subset.facesLength = this.coreMesh.numfaces;
35291
- subset.numBoneIndices = 1;
35292
- this.skinning.subsets.push(subset);
35293
- }
35294
- if (this.skinning.nameTable.length === 0) {
35295
- this.skinning.nameTable.push("Root");
35296
- this.skinning.nameTableSize = 4;
35304
+ this.skinning.increaseSkinnings(missingCount);
35305
+ for (let i = skinningsLength; i < vertsLength; i++) {
35306
+ this.skinning.setIndex(i, [0, 0, 0, 0]);
35307
+ this.skinning.setWeight(i, [0, 0, 0, 0]);
35297
35308
  }
35298
35309
  if (this.skinning.bones.length === 0) {
35299
35310
  const bone = new FileMeshBone();
35311
+ bone.name = "Root";
35300
35312
  bone.boneNameIndex = 0;
35301
35313
  bone.lodParentIndex = 65535;
35302
35314
  bone.parentIndex = 65535;
@@ -35305,11 +35317,21 @@ class FileMesh {
35305
35317
  this.skinning.bones.push(bone);
35306
35318
  }
35307
35319
  }
35320
+ setBoneSource(name) {
35321
+ for (const bone of this.skinning.bones) {
35322
+ bone.sourcePart = name;
35323
+ }
35324
+ }
35325
+ setBoneSourceSize() {
35326
+ for (const bone of this.skinning.bones) {
35327
+ bone.sourceSize = this.size;
35328
+ }
35329
+ }
35308
35330
  combine(other) {
35309
35331
  this.stripLODS();
35310
35332
  other = other.clone();
35311
35333
  other.stripLODS();
35312
- if (this.skinning.skinnings.length > 0 || other.skinning.skinnings.length > 0) {
35334
+ if (this.skinning.numskinnings > 0 || other.skinning.numskinnings > 0) {
35313
35335
  this.padSkinnings();
35314
35336
  other.padSkinnings();
35315
35337
  }
@@ -35333,8 +35355,7 @@ class FileMesh {
35333
35355
  }
35334
35356
  const boneIndexMap = /* @__PURE__ */ new Map();
35335
35357
  for (const bone of other.skinning.bones) {
35336
- const boneName = other.skinning.nameTable[other.skinning.bones.indexOf(bone)];
35337
- const foundBone = this.skinning.getBone(boneName);
35358
+ const foundBone = bone.name ? this.skinning.getBone(bone.name) : void 0;
35338
35359
  if (bone.parentIndex >= 65535) {
35339
35360
  boneIndexMap.set(other.skinning.bones.indexOf(bone), 0);
35340
35361
  continue;
@@ -35343,8 +35364,8 @@ class FileMesh {
35343
35364
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.indexOf(foundBone));
35344
35365
  } else {
35345
35366
  const parentBone = other.skinning.bones[bone.parentIndex];
35346
- const parentName = other.skinning.nameTable[other.skinning.bones.indexOf(parentBone)];
35347
- const foundParentBone = this.skinning.getBone(parentName);
35367
+ const parentName = parentBone.name;
35368
+ const foundParentBone = parentName ? this.skinning.getBone(parentName) : void 0;
35348
35369
  const boneCopy = bone.clone();
35349
35370
  boneCopy.parentIndex = 65535;
35350
35371
  boneCopy.lodParentIndex = 65535;
@@ -35353,31 +35374,20 @@ class FileMesh {
35353
35374
  boneCopy.parentIndex = foundParentIndex;
35354
35375
  boneCopy.lodParentIndex = foundParentIndex;
35355
35376
  }
35356
- this.skinning.nameTable.push(boneName);
35357
35377
  this.skinning.bones.push(boneCopy);
35358
35378
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.length - 1);
35359
35379
  }
35360
35380
  }
35361
- for (const subset of other.skinning.subsets) {
35362
- const newSubset = subset.clone();
35363
- newSubset.facesBegin += facesLength;
35364
- newSubset.vertsBegin += vertsLength;
35365
- for (let i = 0; i < newSubset.boneIndices.length; i++) {
35366
- const index = newSubset.boneIndices[i];
35367
- const newIndex = boneIndexMap.get(index);
35368
- if (index >= 65535) {
35369
- continue;
35370
- }
35371
- if (newIndex === void 0) {
35372
- throw new Error(`Bone ${index} is missing mapping`);
35373
- }
35374
- newSubset.boneIndices[i] = newIndex;
35375
- }
35376
- this.skinning.subsets.push(newSubset);
35377
- }
35378
- for (const skinning of other.skinning.skinnings) {
35379
- const newSkinning = skinning.clone();
35380
- this.skinning.skinnings.push(newSkinning);
35381
+ const ogSkinningsSize = this.skinning.numskinnings;
35382
+ this.skinning.increaseSkinnings(other.skinning.numskinnings);
35383
+ for (let i = 0; i < other.skinning.numskinnings; i++) {
35384
+ this.skinning.setIndex(
35385
+ ogSkinningsSize + i,
35386
+ other.skinning.getIndex(i).map((v) => {
35387
+ return boneIndexMap.get(v);
35388
+ })
35389
+ );
35390
+ this.skinning.setWeight(ogSkinningsSize + i, other.skinning.getWeight(i));
35381
35391
  }
35382
35392
  }
35383
35393
  removeDuplicateVertices(distance2 = 1e-4) {
@@ -35387,9 +35397,6 @@ class FileMesh {
35387
35397
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35388
35398
  const pos = this.coreMesh.getPos(i);
35389
35399
  const uv = this.coreMesh.getUV(i);
35390
- if (this.skinning.subsets.length > 0) {
35391
- vertToSubset[i] = this.skinning.getSubsetIndex(i);
35392
- }
35393
35400
  const hash = hashVec3(pos[0], pos[1], pos[2], distance2) + hashVec2(uv[0], uv[1]);
35394
35401
  const existing = posToIndex.get(hash);
35395
35402
  if (existing !== void 0) {
@@ -35417,10 +35424,7 @@ class FileMesh {
35417
35424
  newIndex.set(canonical, newVerts.length);
35418
35425
  newVerts.push(canonical);
35419
35426
  newSubsetIndices.push(vertToSubset[i]);
35420
- const skinning = this.skinning.skinnings[canonical];
35421
- if (skinning) {
35422
- newSkinnings.push(skinning);
35423
- }
35427
+ newSkinnings.push(canonical);
35424
35428
  }
35425
35429
  remap[i] = newIndex.get(canonical);
35426
35430
  }
@@ -35428,22 +35432,8 @@ class FileMesh {
35428
35432
  const remapFace = this.coreMesh.getFace(remap[i]);
35429
35433
  this.coreMesh.setFace(i, clonePrimitiveArray(remapFace));
35430
35434
  }
35431
- if (this.skinning.subsets.length > 0) {
35432
- for (const subset of this.skinning.subsets) {
35433
- subset.vertsBegin = Infinity;
35434
- subset.vertsLength = 0;
35435
- }
35436
- for (let i = 0; i < newVerts.length; i++) {
35437
- const subsetIndex = newSubsetIndices[i];
35438
- const subset = this.skinning.subsets[subsetIndex];
35439
- if (subset.vertsBegin > i) {
35440
- subset.vertsBegin = i;
35441
- }
35442
- subset.vertsLength += 1;
35443
- }
35444
- }
35445
35435
  this.coreMesh.onlyVerts(newVerts);
35446
- this.skinning.skinnings = newSkinnings;
35436
+ this.skinning.onlySkinnings(newSkinnings);
35447
35437
  return newVerts.length;
35448
35438
  }
35449
35439
  /*removeFace(index: number) {
@@ -35460,29 +35450,15 @@ class FileMesh {
35460
35450
  }
35461
35451
  basicSkin(boneNames) {
35462
35452
  this.skinning = new SKINNING();
35463
- this.skinning.skinnings = new Array(this.coreMesh.numverts);
35453
+ this.skinning.numskinnings = this.coreMesh.numverts;
35464
35454
  this.skinning.bones = new Array(boneNames.length);
35465
- this.skinning.nameTable = boneNames.slice();
35466
- this.skinning.numSkinnings = this.coreMesh.numverts;
35467
- this.skinning.numSubsets = 1;
35468
- this.skinning.numBones = boneNames.length;
35469
- const subset = new FileMeshSubset();
35470
- subset.boneIndices = new Array(26).fill(65535);
35471
- subset.boneIndices[0] = boneNames.length - 1;
35472
- subset.vertsBegin = 0;
35473
- subset.vertsLength = this.coreMesh.numverts;
35474
- subset.facesBegin = 0;
35475
- subset.facesLength = this.coreMesh.numverts;
35476
- subset.numBoneIndices = 1;
35477
- this.skinning.subsets = [subset];
35478
35455
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35479
- const skinning = new FileMeshSkinning();
35480
- skinning.boneWeights = [255, 0, 0, 0];
35481
- skinning.subsetIndices = [0, 0, 0, 0];
35482
- this.skinning.skinnings[i] = skinning;
35456
+ this.skinning.setIndex(i, [boneNames.length - 1, 0, 0, 0]);
35457
+ this.skinning.setWeight(i, [255, 0, 0, 0]);
35483
35458
  }
35484
35459
  for (let i = 0; i < boneNames.length; i++) {
35485
35460
  const bone = new FileMeshBone();
35461
+ bone.name = boneNames[i];
35486
35462
  bone.parentIndex = i - 1;
35487
35463
  if (bone.parentIndex < 0) {
35488
35464
  bone.parentIndex = 65535;
@@ -35494,15 +35470,6 @@ class FileMesh {
35494
35470
  }
35495
35471
  }
35496
35472
  getValidationIssue() {
35497
- if (this.skinning.skinnings.length > 0) {
35498
- let totalSubsetVerts = 0;
35499
- for (const subset of this.skinning.subsets) {
35500
- totalSubsetVerts += subset.vertsLength;
35501
- }
35502
- if (totalSubsetVerts !== this.skinning.skinnings.length) {
35503
- return "subsetLengthMismatch";
35504
- }
35505
- }
35506
35473
  return void 0;
35507
35474
  }
35508
35475
  }
@@ -35655,7 +35622,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
35655
35622
  "X-CSRF-TOKEN": xCsrfToken
35656
35623
  });
35657
35624
  try {
35658
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35625
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35659
35626
  method,
35660
35627
  credentials: FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE,
35661
35628
  headers: fetchHeaders,
@@ -35705,7 +35672,7 @@ async function RBLXGet(url, headers, includeCredentials = true, attempt = 0) {
35705
35672
  }
35706
35673
  const fetchHeaders = new Headers(newHeaders);
35707
35674
  try {
35708
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35675
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35709
35676
  credentials: includeCredentials ? FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE : void 0,
35710
35677
  headers: fetchHeaders,
35711
35678
  priority: FLAGS.ASSET_REQUEST_PRIORITY
@@ -36280,6 +36247,13 @@ const API = {
36280
36247
  return promise;
36281
36248
  }
36282
36249
  },
36250
+ /**
36251
+ * Remember to call .Destroy() on the Instance returned by RBX.generateTree() to avoid memory leaks
36252
+ * @param url
36253
+ * @param headers
36254
+ * @param contentRepresentationPriorityList
36255
+ * @returns
36256
+ */
36283
36257
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36284
36258
  GetRBX: async function(url, headers, contentRepresentationPriorityList) {
36285
36259
  const fetchStr = url;
@@ -36357,6 +36331,7 @@ const API = {
36357
36331
  }
36358
36332
  }
36359
36333
  CACHE.IsLayered.set(id, hasWrapLayer);
36334
+ dataModel.Destroy();
36360
36335
  return hasWrapLayer;
36361
36336
  } else {
36362
36337
  warn(true, "Failed to get accessory");
@@ -36461,6 +36436,18 @@ const API = {
36461
36436
  }
36462
36437
  //https://apis.roblox.com/marketplace-widgets/v1/pills
36463
36438
  },
36439
+ "Develop": {
36440
+ GetLatestVersions: async function(auth, assetIds) {
36441
+ const response = await RBLXPost("https://develop.roblox.com/v1/assets/latest-versions", auth, {
36442
+ assetIds,
36443
+ versionStatus: "Any"
36444
+ });
36445
+ if (response.status !== 200) {
36446
+ return response;
36447
+ }
36448
+ return await response.json();
36449
+ }
36450
+ },
36464
36451
  "Inventory": {
36465
36452
  GetInventory: async function(userId, assetType, cursor) {
36466
36453
  let requestUrl = `https://inventory.roblox.com/v2/users/${userId}/inventory/${assetType}?sortOrder=Desc&limit=100`;
@@ -41202,6 +41189,210 @@ class RenderDesc extends DisposableDesc {
41202
41189
  return this.constructor;
41203
41190
  }
41204
41191
  }
41192
+ function getPartAssemblyScore(part) {
41193
+ let score = 0;
41194
+ if (part.PropOrDefault("Name", "Part") === "HumanoidRootPart") {
41195
+ score += 1e6;
41196
+ }
41197
+ if (part.PropOrDefault("Anchored", false)) {
41198
+ score += 1e5;
41199
+ }
41200
+ if (part.PropOrDefault("Massless", false)) {
41201
+ score += 1e4;
41202
+ }
41203
+ const size = part.PropOrDefault("size", new Vector32(0, 0, 0));
41204
+ score += size.X * size.Y * size.Z;
41205
+ return score;
41206
+ }
41207
+ function getPartsInAssembly_Generate(part) {
41208
+ const inAssembly = [];
41209
+ let toCheck = [part];
41210
+ while (toCheck.length > 0) {
41211
+ const newToCheck = [];
41212
+ for (const part2 of toCheck) {
41213
+ const connected = part2.w.GetConnectedParts();
41214
+ for (const connect of connected) {
41215
+ if (!inAssembly.includes(connect)) {
41216
+ inAssembly.push(connect);
41217
+ newToCheck.push(connect);
41218
+ }
41219
+ }
41220
+ }
41221
+ toCheck = newToCheck;
41222
+ }
41223
+ return inAssembly;
41224
+ }
41225
+ function getRootAssemblyPart_Generate(part) {
41226
+ const parts = getPartsInAssembly_Generate(part);
41227
+ let highestScore = -1;
41228
+ let highestPart = part;
41229
+ for (const part2 of parts) {
41230
+ const score = getPartAssemblyScore(part2);
41231
+ if (score > highestScore) {
41232
+ highestScore = score;
41233
+ highestPart = part2;
41234
+ }
41235
+ }
41236
+ return highestPart;
41237
+ }
41238
+ class AssemblyNode {
41239
+ depth;
41240
+ nodes = [];
41241
+ part;
41242
+ children = [];
41243
+ connectors = [];
41244
+ parent;
41245
+ assembly;
41246
+ traversedRestCFrame = new CFrame();
41247
+ traversedTransformCFrame = new CFrame();
41248
+ constructor(assembly, parent, depth, part, already = []) {
41249
+ this.assembly = assembly;
41250
+ this.parent = parent;
41251
+ this.depth = depth;
41252
+ this.part = part;
41253
+ if (part.IsA("BasePart")) {
41254
+ const w = part.w;
41255
+ w.data.assemblyNode = this;
41256
+ }
41257
+ const connected = part.w.GetConnectedParts();
41258
+ for (const connect of connected) {
41259
+ if (!already.includes(connect)) {
41260
+ this.children.push(connect);
41261
+ }
41262
+ }
41263
+ const jointConnectors = part.w.GetConnectors();
41264
+ this.connectors = jointConnectors;
41265
+ }
41266
+ getNodeChildren() {
41267
+ return this.nodes;
41268
+ }
41269
+ getNodeDescendants() {
41270
+ let descendants = [...this.getNodeChildren()];
41271
+ for (const child of this.getNodeChildren()) {
41272
+ descendants = descendants.concat(child.getNodeDescendants());
41273
+ }
41274
+ return descendants;
41275
+ }
41276
+ getParentConnector() {
41277
+ if (this.parent instanceof Assembly) return;
41278
+ for (const connector of this.connectors) {
41279
+ if (this.parent.connectors.includes(connector)) {
41280
+ return connector;
41281
+ }
41282
+ }
41283
+ }
41284
+ getConnectorOffset(includeTransform) {
41285
+ const parentConnector = this.getParentConnector();
41286
+ if (!parentConnector) return new CFrame();
41287
+ if (parentConnector.Prop("Part0") === this.part) {
41288
+ return parentConnector.Prop("C0");
41289
+ } else if (parentConnector.Prop("Part1") === this.part) {
41290
+ const transform = includeTransform ? parentConnector.PropOrDefault("Transform", new CFrame()) : new CFrame();
41291
+ return parentConnector.Prop("C1").multiply(transform).inverse();
41292
+ }
41293
+ return new CFrame();
41294
+ }
41295
+ _traverseTree(transform, rest) {
41296
+ const parentConnector = this.getParentConnector();
41297
+ if (parentConnector) {
41298
+ const w = parentConnector.w;
41299
+ transform = transform.multiply(w.getAssemblyOffset(true));
41300
+ rest = rest.multiply(w.getAssemblyOffset(false));
41301
+ }
41302
+ this.traversedTransformCFrame = transform.clone();
41303
+ this.traversedRestCFrame = rest.clone();
41304
+ this.part.setProperty("CFrame", this.assembly.traverseCFrame(this, true, true));
41305
+ for (const node of this.nodes) {
41306
+ node._traverseTree(transform, rest);
41307
+ }
41308
+ }
41309
+ /**
41310
+ * Should only be called when destroying entire assembly by calling Assembly.destroy()
41311
+ */
41312
+ destroy() {
41313
+ if (this.part.IsA("BasePart")) {
41314
+ const w = this.part.w;
41315
+ w.data.assemblyNode = void 0;
41316
+ }
41317
+ }
41318
+ }
41319
+ let lastAssemblyId = 0;
41320
+ class Assembly {
41321
+ id = lastAssemblyId++;
41322
+ rootNode;
41323
+ allNodes;
41324
+ allConnectors;
41325
+ constructor(rootPart) {
41326
+ const checked = [rootPart];
41327
+ let depth = 0;
41328
+ this.rootNode = new AssemblyNode(this, this, 0, rootPart, checked);
41329
+ let toCheckNodes = [this.rootNode];
41330
+ while (toCheckNodes.length > 0) {
41331
+ depth += 1;
41332
+ const newToCheckNodes = [];
41333
+ for (const toCheck of toCheckNodes) {
41334
+ for (const child of toCheck.children) {
41335
+ const childNode = new AssemblyNode(this, toCheck, depth, child, checked);
41336
+ checked.push(child);
41337
+ newToCheckNodes.push(childNode);
41338
+ toCheck.nodes.push(childNode);
41339
+ }
41340
+ }
41341
+ toCheckNodes = newToCheckNodes;
41342
+ }
41343
+ this.traverseTree();
41344
+ }
41345
+ getNodeDescendants() {
41346
+ if (!this.allNodes) {
41347
+ this.allNodes = [this.rootNode, ...this.rootNode.getNodeDescendants()];
41348
+ }
41349
+ return this.allNodes;
41350
+ }
41351
+ getPartDescendants() {
41352
+ return this.getNodeDescendants().map((v) => {
41353
+ return v.part;
41354
+ });
41355
+ }
41356
+ getAllConnectors() {
41357
+ if (!this.allConnectors) {
41358
+ this.allConnectors = [];
41359
+ for (const node of this.getNodeDescendants()) {
41360
+ this.allConnectors.push(...node.connectors);
41361
+ }
41362
+ }
41363
+ return this.allConnectors;
41364
+ }
41365
+ getNode(name) {
41366
+ for (const node of this.getNodeDescendants()) {
41367
+ if (node.part.Prop("Name") === name) {
41368
+ return node;
41369
+ }
41370
+ }
41371
+ }
41372
+ getPart(name) {
41373
+ return this.getNode(name)?.part;
41374
+ }
41375
+ traverseTree() {
41376
+ this.rootNode._traverseTree(new CFrame(), new CFrame());
41377
+ }
41378
+ traverseCFrame(node, includeTransform, applyRoot = false) {
41379
+ const traversedCF = includeTransform ? node.traversedTransformCFrame : node.traversedRestCFrame;
41380
+ let finalCF = traversedCF.clone();
41381
+ if (applyRoot) {
41382
+ finalCF = this.rootNode.part.Prop("CFrame").multiply(finalCF);
41383
+ }
41384
+ return finalCF;
41385
+ }
41386
+ traverseInstance(node) {
41387
+ return traverseRigInstance(node.part);
41388
+ }
41389
+ destroy() {
41390
+ const descendants = this.getNodeDescendants();
41391
+ for (const descendant of descendants) {
41392
+ descendant.destroy();
41393
+ }
41394
+ }
41395
+ }
41205
41396
  class AccessoryWrapper extends InstanceWrapper {
41206
41397
  static className = "Accessory";
41207
41398
  static requiredProperties = [
@@ -41265,18 +41456,31 @@ const __vite_glob_0_0$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
41265
41456
  __proto__: null,
41266
41457
  AccessoryWrapper
41267
41458
  }, Symbol.toStringTag, { value: "Module" }));
41268
- class AnimationConstraintWrapper extends InstanceWrapper {
41269
- static className = "AnimationConstraint";
41459
+ class ConstraintWrapper extends InstanceWrapper {
41460
+ static className = "Constraint";
41270
41461
  static requiredProperties = [
41271
41462
  "Name",
41272
41463
  "Attachment0",
41273
- "Attachment1",
41274
- "Transform"
41464
+ "Attachment1"
41275
41465
  ];
41276
41466
  setup() {
41277
41467
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
41278
41468
  if (!this.instance.HasProperty("Attachment0")) this.instance.addProperty(new Property("Attachment0", DataType.Referent), void 0);
41279
41469
  if (!this.instance.HasProperty("Attachment1")) this.instance.addProperty(new Property("Attachment1", DataType.Referent), void 0);
41470
+ }
41471
+ }
41472
+ const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41473
+ __proto__: null,
41474
+ ConstraintWrapper
41475
+ }, Symbol.toStringTag, { value: "Module" }));
41476
+ class AnimationConstraintWrapper extends ConstraintWrapper {
41477
+ static className = "AnimationConstraint";
41478
+ static requiredProperties = [
41479
+ ...super.requiredProperties,
41480
+ "Transform"
41481
+ ];
41482
+ setup() {
41483
+ super.setup();
41280
41484
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
41281
41485
  }
41282
41486
  }
@@ -42139,7 +42343,7 @@ function calculateMotor6Doffset(motor, includeTransform = false) {
42139
42343
  const finalCF = C0.multiply(offset1);
42140
42344
  return finalCF;
42141
42345
  }
42142
- function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42346
+ function traverseRigCFrameNoAssembly(instance, includeTransform = false, applyRoot = false) {
42143
42347
  const motors = [];
42144
42348
  let lastInstance = instance;
42145
42349
  let lastMotor6D = void 0;
@@ -42219,6 +42423,35 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
42219
42423
  }
42220
42424
  return finalCF;
42221
42425
  }
42426
+ function traverseRigCFrameAssembly(instance, includeTransform = false, applyRoot = false) {
42427
+ const motors = [];
42428
+ let assemblyNode = instance.w.GetAssemblyNode();
42429
+ while (!(assemblyNode.parent instanceof Assembly)) {
42430
+ for (const connector of assemblyNode.connectors) {
42431
+ if (assemblyNode.parent.connectors.includes(connector)) {
42432
+ motors.push(connector);
42433
+ break;
42434
+ }
42435
+ }
42436
+ assemblyNode = assemblyNode.parent;
42437
+ }
42438
+ motors.reverse();
42439
+ let finalCF = new CFrame();
42440
+ for (const motor of motors) {
42441
+ finalCF = finalCF.multiply(calculateMotor6Doffset(motor, includeTransform));
42442
+ }
42443
+ if (applyRoot) {
42444
+ finalCF = assemblyNode.assembly.rootNode.part.Prop("CFrame").multiply(finalCF);
42445
+ }
42446
+ return finalCF;
42447
+ }
42448
+ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42449
+ if (FLAGS.USE_ASSEMBLY) {
42450
+ return traverseRigCFrameAssembly(instance, includeTransform, applyRoot);
42451
+ } else {
42452
+ return traverseRigCFrameNoAssembly(instance, includeTransform, applyRoot);
42453
+ }
42454
+ }
42222
42455
  function traverseRigInstanceOld(instance) {
42223
42456
  const children = [];
42224
42457
  let lastMotor6D = instance.FindFirstChildOfClass("Motor6D");
@@ -42236,7 +42469,7 @@ function traverseRigInstanceOld(instance) {
42236
42469
  children.reverse();
42237
42470
  return children;
42238
42471
  }
42239
- function traverseRigInstance(instance) {
42472
+ function traverseRigInstanceNoAssembly(instance) {
42240
42473
  const children = [];
42241
42474
  let lastMotor6D = void 0;
42242
42475
  if (instance.className === "Motor6D" || instance.className === "Weld") {
@@ -42302,6 +42535,23 @@ function traverseRigInstance(instance) {
42302
42535
  children.reverse();
42303
42536
  return children;
42304
42537
  }
42538
+ function traverseRigInstanceAssembly(instance) {
42539
+ const children = [];
42540
+ let assemblyNode = instance.w.GetAssemblyNode();
42541
+ while (!(assemblyNode.parent instanceof Assembly)) {
42542
+ children.push(assemblyNode.part);
42543
+ assemblyNode = assemblyNode.parent;
42544
+ }
42545
+ children.reverse();
42546
+ return children;
42547
+ }
42548
+ function traverseRigInstance(instance) {
42549
+ if (FLAGS.USE_ASSEMBLY) {
42550
+ return traverseRigInstanceAssembly(instance);
42551
+ } else {
42552
+ return traverseRigInstanceNoAssembly(instance);
42553
+ }
42554
+ }
42305
42555
  const modelLayers = /* @__PURE__ */ new Map();
42306
42556
  function arrIsSameVector3(arr0, arr1) {
42307
42557
  if (arr0.length !== arr1.length) {
@@ -42504,6 +42754,12 @@ class ModelLayersDesc {
42504
42754
  }
42505
42755
  return true;
42506
42756
  }
42757
+ getTargetName(i) {
42758
+ if (!this.targetParents) throw new Error("this.targetParents is missing");
42759
+ const targetParents = this.targetParents[i];
42760
+ const targetName = targetParents[targetParents.length - 1];
42761
+ return targetName;
42762
+ }
42507
42763
  fromModel(model) {
42508
42764
  this.targetMeshes = [];
42509
42765
  this.targetCages = [];
@@ -42605,12 +42861,14 @@ class ModelLayersDesc {
42605
42861
  }
42606
42862
  for (let i = 0; i < this.targetMeshes.length; i++) {
42607
42863
  const targetMesh = meshMap.get(this.targetMeshes[i]);
42608
- if (targetMesh.skinning.skinnings.length < 1) {
42864
+ if (targetMesh.skinning.numskinnings < 1) {
42609
42865
  targetMesh.basicSkin(this.targetParents[i]);
42610
42866
  }
42611
42867
  const targetCage = meshMap.get(this.targetCages[i]);
42612
42868
  targetCage.removeDuplicateVertices();
42613
42869
  inheritSkeleton(targetCage, targetMesh);
42870
+ targetCage.setBoneSource(this.getTargetName(i));
42871
+ targetCage.setBoneSourceSize();
42614
42872
  }
42615
42873
  const distDeformer = this.targetDeformers[0];
42616
42874
  const dist_mesh = distDeformer ? meshMap.get(distDeformer.targetCage).clone() : meshMap.get(this.targetCages[0]).clone();
@@ -43045,32 +43303,25 @@ function fileMeshToTHREEGeometry(mesh, canIncludeSkinning = true, forceVertexCol
43045
43303
  const toUseIndices = mesh.coreMesh.getIndices().subarray(facesStart * 3, facesEnd * 3);
43046
43304
  geometry.setIndex(new BufferAttribute(toUseIndices, 1));
43047
43305
  const meshSkinning = mesh.skinning;
43048
- if (meshSkinning && meshSkinning.subsets.length > 0 && canIncludeSkinning) {
43049
- const skinIndices = new Uint16Array(meshSkinning.skinnings.length * 4);
43050
- const skinWeights = new Float32Array(meshSkinning.skinnings.length * 4);
43051
- const hasRootBone = meshSkinning.nameTable.includes("Root") || meshSkinning.nameTable.includes("root");
43052
- for (const subset of meshSkinning.subsets) {
43053
- for (let i = subset.vertsBegin; i < subset.vertsBegin + subset.vertsLength; i++) {
43054
- const skinning = meshSkinning.skinnings[i];
43055
- skinWeights[i * 4 + 0] = skinning.boneWeights[0] / 255;
43056
- skinWeights[i * 4 + 1] = skinning.boneWeights[1] / 255;
43057
- skinWeights[i * 4 + 2] = skinning.boneWeights[2] / 255;
43058
- skinWeights[i * 4 + 3] = skinning.boneWeights[3] / 255;
43059
- if (subset.boneIndices[skinning.subsetIndices[0]] >= 65535 || subset.boneIndices[skinning.subsetIndices[1]] >= 65535 || subset.boneIndices[skinning.subsetIndices[2]] >= 65535 || subset.boneIndices[skinning.subsetIndices[3]] >= 65535) {
43060
- error(mesh);
43061
- error(subset);
43062
- error(skinning);
43063
- throw new Error("mesh is invalid");
43064
- }
43065
- const index0 = subset.boneIndices[skinning.subsetIndices[0]];
43066
- const index1 = subset.boneIndices[skinning.subsetIndices[1]];
43067
- const index2 = subset.boneIndices[skinning.subsetIndices[2]];
43068
- const index3 = subset.boneIndices[skinning.subsetIndices[3]];
43069
- skinIndices[i * 4 + 0] = !hasRootBone && index0 > 0 ? index0 + 1 : index0;
43070
- skinIndices[i * 4 + 1] = !hasRootBone && index1 > 0 ? index1 + 1 : index1;
43071
- skinIndices[i * 4 + 2] = !hasRootBone && index2 > 0 ? index2 + 1 : index2;
43072
- skinIndices[i * 4 + 3] = !hasRootBone && index3 > 0 ? index3 + 1 : index3;
43073
- }
43306
+ if (meshSkinning && meshSkinning.numskinnings > 0 && canIncludeSkinning) {
43307
+ const skinIndices = meshSkinning.indices.slice();
43308
+ const skinWeights = meshSkinning.weights.slice();
43309
+ const hasRootBone = meshSkinning.getBone("Root") !== void 0 || meshSkinning.getBone("root") !== void 0;
43310
+ for (let i = 0; i < meshSkinning.numskinnings; i++) {
43311
+ const boneWeights = meshSkinning.getWeight(i);
43312
+ const boneIndices = meshSkinning.getIndex(i);
43313
+ skinWeights[i * 4 + 0] = boneWeights[0] / 255;
43314
+ skinWeights[i * 4 + 1] = boneWeights[1] / 255;
43315
+ skinWeights[i * 4 + 2] = boneWeights[2] / 255;
43316
+ skinWeights[i * 4 + 3] = boneWeights[3] / 255;
43317
+ const index0 = boneIndices[0];
43318
+ const index1 = boneIndices[1];
43319
+ const index2 = boneIndices[2];
43320
+ const index3 = boneIndices[3];
43321
+ skinIndices[i * 4 + 0] = !hasRootBone && index0 > 0 ? index0 + 1 : index0;
43322
+ skinIndices[i * 4 + 1] = !hasRootBone && index1 > 0 ? index1 + 1 : index1;
43323
+ skinIndices[i * 4 + 2] = !hasRootBone && index2 > 0 ? index2 + 1 : index2;
43324
+ skinIndices[i * 4 + 3] = !hasRootBone && index3 > 0 ? index3 + 1 : index3;
43074
43325
  }
43075
43326
  geometry.setAttribute("skinIndex", new Uint16BufferAttribute(skinIndices, 4));
43076
43327
  geometry.setAttribute("skinWeight", new Float32BufferAttribute(skinWeights, 4));
@@ -43111,6 +43362,7 @@ class MeshDesc {
43111
43362
  instance;
43112
43363
  fileMesh;
43113
43364
  wasAutoSkinned = false;
43365
+ wasDeformed = false;
43114
43366
  dispose() {
43115
43367
  this.instance = void 0;
43116
43368
  }
@@ -43289,14 +43541,13 @@ class MeshDesc {
43289
43541
  }
43290
43542
  if (FLAGS.SHOW_CAGE) {
43291
43543
  the_ref_mesh = dist_mesh;
43292
- the_ref_mesh.skinning.skinnings = [];
43544
+ the_ref_mesh.skinning.numskinnings = 0;
43293
43545
  the_ref_mesh.skinning.bones = [];
43294
- the_ref_mesh.skinning.subsets = [];
43295
43546
  }
43296
43547
  const layeredClothingCacheId = `${this.mesh}-${this.layerDesc.reference}`;
43297
43548
  switch (FLAGS.LAYERED_CLOTHING_ALGORITHM) {
43298
43549
  case "rbf": {
43299
- const shouldAutoSkin = this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledOverride || this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledPreserve && mesh.skinning.skinnings.length < 1 || mesh.skinning.skinnings.length <= 0;
43550
+ const shouldAutoSkin = this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledOverride || this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledPreserve && mesh.skinning.numskinnings < 1 || mesh.skinning.numskinnings <= 0;
43300
43551
  if (FLAGS.AUTO_SKIN_EVERYTHING || shouldAutoSkin) {
43301
43552
  this.wasAutoSkinned = true;
43302
43553
  const transferTo = ref_mesh.clone();
@@ -43308,6 +43559,7 @@ class MeshDesc {
43308
43559
  noDeformation = true;
43309
43560
  }
43310
43561
  rbfDeformer.affectBones = FLAGS.USE_LOCAL_SKELETONDESC;
43562
+ this.wasDeformed = true;
43311
43563
  await rbfDeformer.solveAsync();
43312
43564
  rbfDeformer.deformMesh();
43313
43565
  break;
@@ -43440,7 +43692,7 @@ class MeshDesc {
43440
43692
  let mesh = void 0;
43441
43693
  mesh = await this.getMesh();
43442
43694
  if (mesh instanceof Response) return mesh;
43443
- if (!mesh.facs && this.headMesh && mesh.skinning.skinnings.length > 0) {
43695
+ if (!mesh.facs && this.headMesh && mesh.skinning.numskinnings > 0) {
43444
43696
  const headMesh = await API.Asset.GetMesh(this.headMesh, void 0, true);
43445
43697
  if (headMesh instanceof Response) {
43446
43698
  warn(true, "Failed to get headMesh for compileMesh", headMesh);
@@ -43552,26 +43804,6 @@ class MeshDesc {
43552
43804
  const meshIdStr = child.Property("MeshId");
43553
43805
  this.mesh = meshIdStr;
43554
43806
  this.scaleIsRelative = true;
43555
- if (!FLAGS.AVATAR_JOINT_UPGRADE) {
43556
- if (child.FindFirstChildOfClass("Bone")) {
43557
- this.canHaveSkinning = false;
43558
- } else {
43559
- if (child.Prop("Name").includes("Arm")) {
43560
- const rig = child.parent;
43561
- if (rig) {
43562
- const humanoid = rig.FindFirstChildOfClass("Humanoid");
43563
- if (humanoid) {
43564
- const side = child.Prop("Name").startsWith("Right") ? "Right" : "Left";
43565
- const handName = side + "Hand";
43566
- const hand = rig.FindFirstChild(handName);
43567
- if (hand && hand.FindFirstChildOfClass("Bone")) {
43568
- this.canHaveSkinning = false;
43569
- }
43570
- }
43571
- }
43572
- }
43573
- }
43574
- }
43575
43807
  const surfaceAppearance = child.FindLastChildOfClass("SurfaceAppearance");
43576
43808
  if (surfaceAppearance) {
43577
43809
  const color = surfaceAppearance.HasProperty("Color") ? surfaceAppearance.Prop("Color") : new Color3(1, 1, 1);
@@ -43762,14 +43994,19 @@ class _TextureComposer {
43762
43994
  }
43763
43995
  }
43764
43996
  const TextureComposer = new _TextureComposer(1, 1);
43765
- const vertexShader$5 = `
43997
+ const vertexShader$5 = (
43998
+ /*glsl*/
43999
+ `
43766
44000
  varying vec2 vUv;
43767
44001
  void main() {
43768
44002
  vUv = uv;
43769
44003
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
43770
44004
  }
43771
- `;
43772
- const fragmentShader$5 = `
44005
+ `
44006
+ );
44007
+ const fragmentShader$5 = (
44008
+ /*glsl*/
44009
+ `
43773
44010
  uniform sampler2D uTexture;
43774
44011
  varying vec2 vUv;
43775
44012
  void main() {
@@ -43777,7 +44014,8 @@ void main() {
43777
44014
  vec4 texColor = texture2D(uTexture, vUv);
43778
44015
  gl_FragColor = texColor;
43779
44016
  }
43780
- `;
44017
+ `
44018
+ );
43781
44019
  const Shader_TextureComposer_Flat = new ShaderMaterial({
43782
44020
  uniforms: {
43783
44021
  uTexture: { value: void 0 }
@@ -43787,7 +44025,9 @@ const Shader_TextureComposer_Flat = new ShaderMaterial({
43787
44025
  depthWrite: false,
43788
44026
  transparent: true
43789
44027
  });
43790
- const vertexShader$4 = `
44028
+ const vertexShader$4 = (
44029
+ /*glsl*/
44030
+ `
43791
44031
  uniform vec2 uOffset;
43792
44032
  uniform vec2 uSize;
43793
44033
  varying vec2 vUv;
@@ -43796,8 +44036,11 @@ void main() {
43796
44036
  vec2 mapUv = vec2(uv.x * uSize.x + uOffset.x, uv.y * uSize.y + uOffset.y);
43797
44037
  gl_Position = vec4(mapUv.x * 2.0 - 1.0, mapUv.y * 2.0 - 1.0, 0.0, 1.0);
43798
44038
  }
43799
- `;
43800
- const fragmentShader$4 = `
44039
+ `
44040
+ );
44041
+ const fragmentShader$4 = (
44042
+ /*glsl*/
44043
+ `
43801
44044
  uniform sampler2D uTexture;
43802
44045
  varying vec2 vUv;
43803
44046
  void main() {
@@ -43805,7 +44048,8 @@ void main() {
43805
44048
  vec4 texColor = texture2D(uTexture, vUv);
43806
44049
  gl_FragColor = texColor;
43807
44050
  }
43808
- `;
44051
+ `
44052
+ );
43809
44053
  const Shader_TextureComposer_FullscreenQuad = new ShaderMaterial({
43810
44054
  uniforms: {
43811
44055
  uTexture: { value: void 0 },
@@ -43817,17 +44061,23 @@ const Shader_TextureComposer_FullscreenQuad = new ShaderMaterial({
43817
44061
  depthWrite: false,
43818
44062
  transparent: true
43819
44063
  });
43820
- const vertexShader$3 = `
44064
+ const vertexShader$3 = (
44065
+ /*glsl*/
44066
+ `
43821
44067
  void main() {
43822
44068
  gl_Position = vec4(uv.x * 2.0 - 1.0, uv.y * 2.0 - 1.0, 0.0, 1.0);
43823
44069
  }
43824
- `;
43825
- const fragmentShader$3 = `
44070
+ `
44071
+ );
44072
+ const fragmentShader$3 = (
44073
+ /*glsl*/
44074
+ `
43826
44075
  uniform vec3 uColor;
43827
44076
  void main() {
43828
44077
  gl_FragColor = vec4(uColor, 1.0);
43829
44078
  }
43830
- `;
44079
+ `
44080
+ );
43831
44081
  const Shader_TextureComposer_FullscreenQuad_Color = new ShaderMaterial({
43832
44082
  uniforms: {
43833
44083
  uColor: { value: new Color(0, 0, 0) }
@@ -43837,17 +44087,23 @@ const Shader_TextureComposer_FullscreenQuad_Color = new ShaderMaterial({
43837
44087
  depthWrite: false,
43838
44088
  transparent: true
43839
44089
  });
43840
- const vertexShader$2 = `
44090
+ const vertexShader$2 = (
44091
+ /*glsl*/
44092
+ `
43841
44093
  void main() {
43842
44094
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
43843
44095
  }
43844
- `;
43845
- const fragmentShader$2 = `
44096
+ `
44097
+ );
44098
+ const fragmentShader$2 = (
44099
+ /*glsl*/
44100
+ `
43846
44101
  uniform vec3 uColor;
43847
44102
  void main() {
43848
44103
  gl_FragColor = vec4(uColor, 1.0);
43849
44104
  }
43850
- `;
44105
+ `
44106
+ );
43851
44107
  const Shader_TextureComposer_Flat_Color = new ShaderMaterial({
43852
44108
  uniforms: {
43853
44109
  uColor: { value: new Color(0, 0, 0) }
@@ -43857,7 +44113,9 @@ const Shader_TextureComposer_Flat_Color = new ShaderMaterial({
43857
44113
  depthWrite: false,
43858
44114
  transparent: true
43859
44115
  });
43860
- const vertexShader$1 = `
44116
+ const vertexShader$1 = (
44117
+ /*glsl*/
44118
+ `
43861
44119
  uniform mat4 uTextureProjMat;
43862
44120
 
43863
44121
  varying vec2 vUv;
@@ -43870,8 +44128,11 @@ void main() {
43870
44128
  vNormal = normalize(normalMatrix * normal);
43871
44129
  gl_Position = vec4(uv.x * 2.0 - 1.0, uv.y * 2.0 - 1.0, 0.0, 1.0);
43872
44130
  }
43873
- `;
43874
- const fragmentShader$1 = `
44131
+ `
44132
+ );
44133
+ const fragmentShader$1 = (
44134
+ /*glsl*/
44135
+ `
43875
44136
  uniform sampler2D uTexture;
43876
44137
  uniform vec3 uDecalNormal;
43877
44138
 
@@ -43897,7 +44158,8 @@ void main() {
43897
44158
  vec4 texColor = texture2D(uTexture, vTextureProjCoord);
43898
44159
  gl_FragColor = texColor;
43899
44160
  }
43900
- `;
44161
+ `
44162
+ );
43901
44163
  const Shader_TextureComposer_Decal = new ShaderMaterial({
43902
44164
  uniforms: {
43903
44165
  uTexture: { value: void 0 },
@@ -43909,7 +44171,9 @@ const Shader_TextureComposer_Decal = new ShaderMaterial({
43909
44171
  depthWrite: false,
43910
44172
  transparent: true
43911
44173
  });
43912
- const vertexShader = `
44174
+ const vertexShader = (
44175
+ /*glsl*/
44176
+ `
43913
44177
  uniform vec2 uOffset;
43914
44178
  uniform vec2 uSize;
43915
44179
  varying vec2 vUv;
@@ -43918,10 +44182,22 @@ void main() {
43918
44182
  vec2 mapUv = vec2(uv.x * uSize.x + uOffset.x, uv.y * uSize.y + uOffset.y);
43919
44183
  gl_Position = vec4(mapUv.x * 2.0 - 1.0, mapUv.y * 2.0 - 1.0, 0.0, 1.0);
43920
44184
  }
43921
- `;
43922
- const fragmentShader = `
44185
+ `
44186
+ );
44187
+ const fragmentShader = (
44188
+ /*glsl*/
44189
+ `
43923
44190
  uniform sampler2D uTexture;
43924
44191
  varying vec2 vUv;
44192
+
44193
+ vec3 sRGBToLinear(vec3 color) {
44194
+ return mix(
44195
+ color / 12.92,
44196
+ pow((color + 0.055) / 1.055, vec3(2.4)),
44197
+ step(0.04045, color)
44198
+ );
44199
+ }
44200
+
43925
44201
  void main() {
43926
44202
  //sample the original render texture result
43927
44203
  vec4 texColor = texture2D(uTexture, vUv);
@@ -43931,9 +44207,10 @@ void main() {
43931
44207
  }
43932
44208
 
43933
44209
  //convert to linear
43934
- gl_FragColor = vec4(pow(texColor.rgb, vec3(2.2)), texColor.a);
44210
+ gl_FragColor = vec4(sRGBToLinear(texColor.rgb), texColor.a);
43935
44211
  }
43936
- `;
44212
+ `
44213
+ );
43937
44214
  const Shader_TextureComposer_Gamma = new ShaderMaterial({
43938
44215
  uniforms: {
43939
44216
  uTexture: { value: void 0 },
@@ -44886,11 +45163,89 @@ class MaterialDesc {
44886
45163
  }
44887
45164
  }
44888
45165
  }
44889
- class FaceControlsWrapper extends InstanceWrapper {
44890
- static className = "FaceControls";
44891
- static requiredProperties = ["Name", ...FaceControlNames];
44892
- setup() {
44893
- if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
45166
+ class BasePartWrapperData {
45167
+ assemblyNode;
45168
+ }
45169
+ class BasePartWrapper extends InstanceWrapper {
45170
+ static className = "BasePart";
45171
+ static requiredProperties = [
45172
+ "Name",
45173
+ "CFrame",
45174
+ "size",
45175
+ "Transparency",
45176
+ "_data"
45177
+ ];
45178
+ setup() {
45179
+ if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
45180
+ if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
45181
+ if (!this.instance.HasProperty("size")) this.instance.addProperty(new Property("size", DataType.Vector3), new Vector32());
45182
+ if (!this.instance.HasProperty("Transparency")) this.instance.addProperty(new Property("Transparency", DataType.Float32), 0);
45183
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new BasePartWrapperData());
45184
+ }
45185
+ get data() {
45186
+ return this.instance.Prop("_data");
45187
+ }
45188
+ created() {
45189
+ const destroyAssembly = () => {
45190
+ if (this.data.assemblyNode) {
45191
+ this.data.assemblyNode.assembly.destroy();
45192
+ }
45193
+ };
45194
+ this.instance.referencedByChanged.Connect(destroyAssembly);
45195
+ this.instance.AncestryChanged.Connect(destroyAssembly);
45196
+ this.instance.ChildRemoved.Connect(destroyAssembly);
45197
+ this.instance.Destroying.Connect(destroyAssembly);
45198
+ }
45199
+ preRender() {
45200
+ if (FLAGS.USE_ASSEMBLY) {
45201
+ const assemblyNode = this.GetAssemblyNode();
45202
+ if (assemblyNode.depth === 0) {
45203
+ assemblyNode.assembly.traverseTree();
45204
+ }
45205
+ }
45206
+ }
45207
+ GetAssemblyNode() {
45208
+ if (this.data.assemblyNode) return this.data.assemblyNode;
45209
+ const rootPart = getRootAssemblyPart_Generate(this.instance);
45210
+ new Assembly(rootPart);
45211
+ return this.data.assemblyNode;
45212
+ }
45213
+ GetAssembly() {
45214
+ return this.GetAssemblyNode().assembly;
45215
+ }
45216
+ GetConnectors() {
45217
+ const connectors = [];
45218
+ const references = this.instance.getReferencedBy();
45219
+ for (const reference of references) {
45220
+ if (reference.IsA("JointInstance")) {
45221
+ connectors.push(reference);
45222
+ }
45223
+ }
45224
+ return connectors;
45225
+ }
45226
+ GetConnectedParts() {
45227
+ const connected = [];
45228
+ const references = this.instance.getReferencedBy();
45229
+ for (const reference of references) {
45230
+ if (reference.IsA("JointInstance")) {
45231
+ const part0 = reference.Prop("Part0");
45232
+ const part1 = reference.Prop("Part1");
45233
+ if (part0 && part0 !== this.instance && part0.IsA("BasePart")) connected.push(part0);
45234
+ if (part1 && part1 !== this.instance && part1.IsA("BasePart")) connected.push(part1);
45235
+ }
45236
+ }
45237
+ return connected;
45238
+ }
45239
+ }
45240
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45241
+ __proto__: null,
45242
+ BasePartWrapper
45243
+ }, Symbol.toStringTag, { value: "Module" }));
45244
+ class FaceControlsWrapper extends InstanceWrapper {
45245
+ static className = "FaceControls";
45246
+ static requiredProperties = ["Name", ...FaceControlNames];
45247
+ setup() {
45248
+ if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
44894
45249
  for (const propertyName of FaceControlsWrapper.requiredProperties) {
44895
45250
  if (!this.instance.HasProperty(propertyName)) {
44896
45251
  this.instance.addProperty(new Property(propertyName, DataType.NonSerializable), 0);
@@ -44898,27 +45253,12 @@ class FaceControlsWrapper extends InstanceWrapper {
44898
45253
  }
44899
45254
  }
44900
45255
  }
44901
- const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45256
+ const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44902
45257
  __proto__: null,
44903
45258
  FaceControlsWrapper
44904
45259
  }, Symbol.toStringTag, { value: "Module" }));
44905
- const BaseR15Bones = ["Root", "HumanoidRootNode", "LowerTorso", "UpperTorso", "RightUpperArm", "RightLowerArm", "RightHand", "LeftUpperArm", "LeftLowerArm", "LeftHand", "Head", "DynamicHead"];
44906
- function getJointForInstances$1(parent, child, includeTransform) {
44907
- const childMotor = child.FindFirstChildOfClass("Motor6D");
44908
- const parentMotor = parent.FindFirstChildOfClass("Motor6D");
44909
- let transform = new CFrame();
44910
- if (childMotor) {
44911
- if (includeTransform) {
44912
- transform = childMotor.Prop("Transform");
44913
- }
44914
- let initalCF = new CFrame();
44915
- if (parentMotor) {
44916
- initalCF = parentMotor.Prop("C1").inverse();
44917
- }
44918
- const jointCF = initalCF.multiply(childMotor.Prop("C0")).multiply(transform.inverse());
44919
- return jointCF;
44920
- }
44921
- return new CFrame();
45260
+ function diffCFrame(parent, child) {
45261
+ return parent.inverse().multiply(child);
44922
45262
  }
44923
45263
  function boneIsChildOf(bone, parentName) {
44924
45264
  let nextParent = bone.parent;
@@ -44930,73 +45270,16 @@ function boneIsChildOf(bone, parentName) {
44930
45270
  }
44931
45271
  return false;
44932
45272
  }
44933
- function getBoneBaseR15Parent(bone) {
44934
- let currentParent = bone.parent;
44935
- if (!currentParent) return;
44936
- while (currentParent && !BaseR15Bones.includes(currentParent.name)) {
44937
- currentParent = currentParent.parent;
44938
- }
44939
- if (!currentParent) {
44940
- return bone.parent;
44941
- } else {
44942
- return currentParent;
44943
- }
44944
- }
44945
- function boneIsBaseR15(bone) {
44946
- return BaseR15Bones.includes(bone.name);
44947
- }
44948
- function getMotorsInRig(rigChildren) {
44949
- const motors = [];
44950
- for (const child of rigChildren) {
44951
- for (const motor of child.GetChildren()) {
44952
- if (motor.className === "Motor6D") {
44953
- motors.push(motor);
44954
- }
44955
- }
44956
- }
44957
- return motors;
44958
- }
44959
- function getBoneDependencies(rig) {
44960
- const names = /* @__PURE__ */ new Map();
44961
- const hrp = rig.FindFirstChild("HumanoidRootPart");
44962
- let currentSearch = hrp ? [hrp] : [];
44963
- let currentSearchOrigin = hrp ? ["Root"] : [];
44964
- const children = rig.GetChildren();
44965
- const motors = getMotorsInRig(children);
44966
- const searchedParts = [];
44967
- while (currentSearch.length > 0 && currentSearch[0]) {
44968
- const newCurrentSearch = [];
44969
- const newCurrentSearchOrigin = [];
44970
- for (let i = 0; i < currentSearch.length; i++) {
44971
- const toSearch = currentSearch[i];
44972
- searchedParts.push(toSearch);
44973
- const selfName = toSearch === hrp ? "HumanoidRootNode" : toSearch.Prop("Name");
44974
- names.set(selfName, currentSearchOrigin[i]);
44975
- for (const motor of motors) {
44976
- if (motor.Prop("Part0") === toSearch && !searchedParts.includes(motor.parent)) {
44977
- newCurrentSearch.push(motor.parent);
44978
- newCurrentSearchOrigin.push(selfName);
44979
- }
44980
- }
44981
- }
44982
- currentSearch = newCurrentSearch;
44983
- currentSearchOrigin = newCurrentSearchOrigin;
44984
- }
44985
- if (names.get("Head")) {
44986
- names.set("DynamicHead", "Head");
44987
- }
44988
- return names;
44989
- }
44990
- let SkeletonDesc$1 = class SkeletonDesc {
45273
+ class SkeletonDesc {
44991
45274
  renderableDesc;
44992
45275
  meshDesc;
44993
45276
  skeleton;
44994
45277
  rootBone;
44995
45278
  bones;
44996
45279
  originalBoneCFrames = [];
44997
- originalHeadCFrame = new CFrame();
44998
- originalDynamicHeadCFrame = new CFrame();
45280
+ boneSourceParts = [];
44999
45281
  skeletonHelper;
45282
+ frameCount = 0;
45000
45283
  constructor(renderableDesc, meshDesc, scene) {
45001
45284
  this.renderableDesc = renderableDesc;
45002
45285
  this.meshDesc = meshDesc;
@@ -45008,9 +45291,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45008
45291
  const boneArr = [];
45009
45292
  for (let i = 0; i < skinning.bones.length; i++) {
45010
45293
  const threeBone = new Bone();
45011
- threeBone.name = skinning.nameTable[i];
45012
- if (threeBone.name === "HumanoidRootPart") {
45013
- threeBone.name = "HumanoidRootNode";
45294
+ threeBone.name = skinning.bones[i].name || "";
45295
+ if (threeBone.name === "HumanoidRootNode") {
45296
+ threeBone.name = "HumanoidRootPart";
45014
45297
  }
45015
45298
  if (threeBone.name === "root") {
45016
45299
  threeBone.name = "Root";
@@ -45019,6 +45302,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45019
45302
  }
45020
45303
  this.bones = boneArr;
45021
45304
  log(false, skinning);
45305
+ log(false, this);
45022
45306
  let rootBone = void 0;
45023
45307
  for (let i = 0; i < skinning.bones.length; i++) {
45024
45308
  const bone = skinning.bones[i];
@@ -45031,18 +45315,15 @@ let SkeletonDesc$1 = class SkeletonDesc {
45031
45315
  const worldBoneCF = new CFrame(...bone.position);
45032
45316
  worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45033
45317
  const boneCF = worldParentBoneCF.inverse().multiply(worldBoneCF);
45034
- this.originalBoneCFrames.push(boneCF);
45035
- if (threeBone.name === "Head") {
45036
- this.originalHeadCFrame = boneCF;
45037
- } else if (threeBone.name === "DynamicHead") {
45038
- this.originalDynamicHeadCFrame = boneCF;
45039
- }
45318
+ this.boneSourceParts.push(bone.sourcePart);
45319
+ this.originalBoneCFrames.push(worldBoneCF);
45040
45320
  setTHREEObjectCF(threeBone, boneCF);
45041
45321
  parentThreeBone.add(threeBone);
45042
45322
  } else {
45043
45323
  rootBone = threeBone;
45044
45324
  const boneCF = new CFrame(...bone.position);
45045
45325
  boneCF.fromRotationMatrix(...bone.rotationMatrix);
45326
+ this.boneSourceParts.push(bone.sourcePart);
45046
45327
  this.originalBoneCFrames.push(boneCF);
45047
45328
  setTHREEObjectCF(threeBone, boneCF);
45048
45329
  }
@@ -45056,6 +45337,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45056
45337
  trueRootBone.name = "Root";
45057
45338
  trueRootBone.position.set(0, 0, 0);
45058
45339
  trueRootBone.rotation.set(0, 0, 0, "YXZ");
45340
+ this.boneSourceParts.unshift(void 0);
45059
45341
  this.originalBoneCFrames.unshift(new CFrame());
45060
45342
  this.bones.unshift(trueRootBone);
45061
45343
  trueRootBone.add(rootBone);
@@ -45063,23 +45345,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45063
45345
  }
45064
45346
  this.rootBone = rootBone;
45065
45347
  }
45066
- const rig = this.getRig();
45067
- if (rig) {
45068
- const boneDependencies = getBoneDependencies(rig);
45069
- for (const bone of [...this.bones]) {
45070
- let lastBone = bone.name;
45071
- while (lastBone) {
45072
- const newLastBone = boneDependencies.get(lastBone);
45073
- if (newLastBone && !this.getBoneWithName(newLastBone)) {
45074
- this.insertBefore(newLastBone, lastBone);
45075
- }
45076
- lastBone = newLastBone;
45077
- }
45078
- }
45079
- }
45080
45348
  this.skeleton = new Skeleton(boneArr);
45081
45349
  this.setAsRest();
45082
- if (FLAGS.SHOW_SKELETON_HELPER) {
45350
+ if (FLAGS.SHOW_SKELETON_HELPER && (FLAGS.SKELETON_HELPER_INSTANCE_NAME === void 0 || FLAGS.SKELETON_HELPER_INSTANCE_NAME === meshDesc.instance?.name)) {
45083
45351
  const skeletonHelper = new SkeletonHelper(this.rootBone);
45084
45352
  scene.add(skeletonHelper);
45085
45353
  this.skeletonHelper = skeletonHelper;
@@ -45092,39 +45360,6 @@ let SkeletonDesc$1 = class SkeletonDesc {
45092
45360
  this.skeleton.boneInverses[boneIndex].copy(bone.matrixWorld).invert();
45093
45361
  }
45094
45362
  }
45095
- traverseOriginal(name) {
45096
- const cframes = [];
45097
- let lastBone = this.getBoneWithName(name);
45098
- while (lastBone) {
45099
- const index = this.bones.indexOf(lastBone);
45100
- const ogCFrame = this.originalBoneCFrames[index];
45101
- cframes.push(ogCFrame);
45102
- lastBone = lastBone.parent ? this.getBoneWithName(lastBone.parent.name) : void 0;
45103
- }
45104
- cframes.reverse();
45105
- let finalCF = new CFrame();
45106
- for (const cf of cframes) {
45107
- finalCF = finalCF.multiply(cf);
45108
- }
45109
- return finalCF;
45110
- }
45111
- insertBefore(toInsert, before) {
45112
- const bone = new Bone();
45113
- bone.name = toInsert;
45114
- bone.position.set(0, 0, 0);
45115
- bone.rotation.set(0, 0, 0, "YXZ");
45116
- for (let i = 0; i < this.bones.length; i++) {
45117
- if (this.bones[i].name === before) {
45118
- const beforeBone = this.bones[i];
45119
- const beforeParent = beforeBone.parent;
45120
- this.originalBoneCFrames.push(new CFrame());
45121
- this.bones.push(bone);
45122
- bone.add(beforeBone);
45123
- beforeParent?.add(bone);
45124
- break;
45125
- }
45126
- }
45127
- }
45128
45363
  getBoneWithName(name) {
45129
45364
  for (const bone of this.bones) {
45130
45365
  if (bone.name === name) {
@@ -45143,377 +45378,160 @@ let SkeletonDesc$1 = class SkeletonDesc {
45143
45378
  return rig;
45144
45379
  }
45145
45380
  }
45146
- getPartEquivalent(selfInstance, name) {
45147
- if (!selfInstance.parent) return;
45148
- let partEquivalent = selfInstance.parent.FindFirstChild(name);
45149
- if (partEquivalent === void 0 && selfInstance.parent.parent) {
45150
- partEquivalent = selfInstance.parent.parent.FindFirstChild(name);
45151
- }
45152
- return partEquivalent;
45381
+ getScale(node) {
45382
+ if (this.meshDesc.wasAutoSkinned) return new Vector32(1, 1, 1);
45383
+ const partSize = node.part.Prop("Size");
45384
+ const meshSize = node.part.PropOrDefault("InitialSize", new Vector32(...this.meshDesc.fileMesh.size));
45385
+ const scale = partSize.divide(meshSize);
45386
+ return scale;
45153
45387
  }
45154
- getRootCFrame(instance, includeTransform) {
45155
- if (includeTransform) {
45156
- return instance.Prop("CFrame");
45157
- } else {
45158
- let bodyPart = void 0;
45159
- if (instance.parent && instance.parent.FindFirstChildOfClass("Humanoid")) {
45160
- bodyPart = instance;
45161
- } else if (instance.parent && instance.parent.parent && instance.parent.className === "Accessory") {
45162
- bodyPart = GetAttachedPart(instance.parent, instance.parent.parent);
45163
- }
45164
- const hrp = this.getPartEquivalent(instance, "HumanoidRootPart");
45165
- if (hrp && bodyPart) {
45166
- return hrp.Prop("CFrame").multiply(traverseRigCFrame(bodyPart));
45167
- }
45168
- }
45169
- return new CFrame();
45388
+ getOriginalWorldCFrameNoChange(bone) {
45389
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45390
+ return ogCF;
45170
45391
  }
45171
- updateBoneMatrix(selfInstance, includeTransform = false) {
45172
- if (!selfInstance.parent) return;
45173
- if (!this.meshDesc.fileMesh) return;
45174
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45175
- const rootBoneCFog = this.getRootCFrame(selfInstance, includeTransform);
45176
- const humanoidRootPartEquivalent = this.getPartEquivalent(selfInstance, "HumanoidRootPart");
45177
- for (let i = 0; i < this.bones.length; i++) {
45178
- const bone = this.bones[i];
45179
- const partEquivalent = this.getPartEquivalent(selfInstance, bone.name);
45180
- const boneParent = boneIsBaseR15(bone) ? getBoneBaseR15Parent(bone) : bone.parent;
45181
- const parentPartEquivalent = boneParent ? boneParent.name !== "HumanoidRootNode" ? this.getPartEquivalent(selfInstance, boneParent.name) : humanoidRootPartEquivalent : void 0;
45182
- let rootBoneCF = new CFrame();
45183
- if (bone.name === "Root") {
45184
- rootBoneCF = rootBoneCFog;
45185
- } else if (bone.parent?.name === "Root") {
45186
- rootBoneCF = rootBoneCFog.inverse();
45187
- }
45188
- if (partEquivalent && parentPartEquivalent) {
45189
- setTHREEObjectCF(bone, rootBoneCF.multiply(getJointForInstances$1(parentPartEquivalent, partEquivalent, includeTransform)));
45190
- } else if (partEquivalent) {
45191
- if (includeTransform) {
45192
- setTHREEObjectCF(bone, rootBoneCF.multiply(partEquivalent.Prop("CFrame")));
45193
- } else {
45194
- let hrpCF = new CFrame();
45195
- const hrp = humanoidRootPartEquivalent;
45196
- if (hrp) {
45197
- hrpCF = hrp.Prop("CFrame");
45198
- }
45199
- setTHREEObjectCF(bone, rootBoneCF.multiply(hrpCF.multiply(traverseRigCFrame(partEquivalent))));
45200
- }
45201
- } else if (bone.name === "Root") {
45202
- setTHREEObjectCF(bone, rootBoneCF.multiply(new CFrame()));
45203
- } else if (bone.name === "HumanoidRootNode") {
45204
- let rootCF = new CFrame();
45205
- const rootPart = humanoidRootPartEquivalent;
45206
- if (rootPart) {
45207
- rootCF = rootPart.Prop("CFrame");
45208
- }
45209
- setTHREEObjectCF(bone, rootBoneCF.multiply(rootCF));
45210
- } else if (bone.name === "DynamicHead" && isHead) {
45211
- const head = this.getPartEquivalent(selfInstance, "Head");
45212
- if (head) {
45213
- let targetCF = this.traverseOriginal("DynamicHead");
45214
- if (this.meshDesc.wasAutoSkinned) {
45215
- targetCF = this.originalBoneCFrames[i];
45216
- }
45217
- const headSize = head.Prop("Size");
45218
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45219
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45220
- if (this.meshDesc.wasAutoSkinned) {
45221
- scale = [1, 1, 1];
45222
- }
45223
- const scaledCF = targetCF.clone();
45224
- scaledCF.Position = multiply(scaledCF.Position, scale);
45225
- const neck = head.FindFirstChildOfClass("Motor6D");
45226
- let neckCF = new CFrame();
45227
- if (neck) {
45228
- neckCF = neck.PropOrDefault("C1", new CFrame());
45229
- }
45230
- if (this.meshDesc.wasAutoSkinned) {
45231
- neckCF = new CFrame();
45232
- }
45233
- const totalCF = neckCF.inverse().multiply(scaledCF);
45234
- setTHREEObjectCF(bone, totalCF);
45235
- }
45236
- } else if (!isHead || boneIsChildOf(bone, "DynamicHead")) {
45237
- const ogCF = this.originalBoneCFrames[i];
45238
- const head = this.getPartEquivalent(selfInstance, "Head");
45239
- if (head) {
45240
- const headSize = head.Prop("Size");
45241
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45242
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45243
- if (this.meshDesc.wasAutoSkinned) {
45244
- scale = [1, 1, 1];
45245
- }
45246
- const scaledCF = ogCF.clone();
45247
- scaledCF.Position = multiply(scaledCF.Position, scale);
45248
- const headOffset = this.originalHeadCFrame.clone();
45249
- headOffset.Position = [0, 0, 0];
45250
- if (bone.name !== "DynamicHead") {
45251
- headOffset.Orientation = [0, 0, 0];
45252
- }
45253
- const finalCF = headOffset.multiply(scaledCF);
45254
- setTHREEObjectCF(bone, finalCF);
45255
- }
45392
+ getOriginalWorldCFrame(bone, node) {
45393
+ if (this.meshDesc.wasAutoSkinned) {
45394
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45395
+ const nodeWorldCF = node.assembly.traverseCFrame(node, false, false);
45396
+ return nodeWorldCF.inverse().multiply(ogCF);
45397
+ } else {
45398
+ const scale = this.getScale(node);
45399
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45400
+ ogCF.Position = multiply(ogCF.Position, scale.toVec3());
45401
+ return ogCF;
45402
+ }
45403
+ }
45404
+ getSourcePart(bone) {
45405
+ return this.boneSourceParts[this.bones.indexOf(bone)];
45406
+ }
45407
+ getSourceNode(selfNode, bone, assembly) {
45408
+ const sourceName = this.getSourcePart(bone);
45409
+ const potentialSourceNode = sourceName ? assembly.getNode(sourceName) : selfNode;
45410
+ const sourceNode = potentialSourceNode ? potentialSourceNode : selfNode;
45411
+ return sourceNode;
45412
+ }
45413
+ getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform) {
45414
+ const node = assembly.getNode(bone.name);
45415
+ const selfNode = selfInstance.w.GetAssemblyNode();
45416
+ const sourceNode = this.getSourceNode(selfNode, bone, assembly);
45417
+ if (bone.name === "Root") {
45418
+ return assembly.traverseCFrame(selfNode, includeTransform, true);
45419
+ } else if (node) {
45420
+ if (this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned && bone.name === "Head") {
45421
+ const ogCF = assembly.traverseCFrame(node, includeTransform, true);
45422
+ const connectorOffset = node.getConnectorOffset(includeTransform).inverse();
45423
+ connectorOffset.Orientation = [0, 0, 0];
45424
+ return ogCF.multiply(connectorOffset);
45425
+ } else {
45426
+ return assembly.traverseCFrame(node, includeTransform, true);
45256
45427
  }
45257
- }
45258
- this.updateMatrixWorld();
45259
- if (!includeTransform) {
45260
- this.setAsRest();
45261
- this.updateMatrixWorld();
45262
- }
45263
- }
45264
- updateMatrixWorld() {
45265
- for (const bone of this.skeleton.bones) {
45266
- bone.updateMatrixWorld(true);
45428
+ } else {
45429
+ const result = assembly.traverseCFrame(sourceNode, includeTransform, true).multiply(this.getOriginalWorldCFrame(bone, sourceNode));
45430
+ return result;
45267
45431
  }
45268
45432
  }
45269
- update(instance) {
45270
- if (!FLAGS.UPDATE_SKELETON || !instance.parent || !this.meshDesc.fileMesh) return;
45271
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45272
- this.updateBoneMatrix(instance);
45273
- if (FLAGS.ANIMATE_SKELETON) {
45274
- this.updateBoneMatrix(instance, true);
45275
- for (const bone of this.skeleton.bones) {
45276
- const isFACS = this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(bone.name);
45277
- if (isFACS) {
45278
- const facsMesh = this.meshDesc.fileMesh;
45279
- const facs = this.meshDesc.fileMesh?.facs;
45280
- const head = this.getPartEquivalent(instance, "Head");
45281
- if (head && facsMesh && facs && facs.quantizedTransforms) {
45282
- const headSize = head.Prop("Size");
45283
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45284
- let headScale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45285
- if (this.meshDesc.wasAutoSkinned) {
45286
- headScale = [1, 1, 1];
45287
- }
45288
- let faceControls = head.FindFirstChildOfClass("FaceControls");
45289
- if (!faceControls) {
45290
- faceControls = new Instance("FaceControls");
45291
- faceControls.setParent(head);
45292
- }
45293
- new FaceControlsWrapper(faceControls);
45294
- for (let j = 0; j < facs.faceBoneNames.length; j++) {
45295
- const boneName = facs.faceBoneNames[j];
45296
- if (boneName === bone.name) {
45297
- let jointCF = new CFrame();
45298
- const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)];
45299
- jointCF = ogCF.clone();
45300
- const head2 = this.getPartEquivalent(instance, "Head");
45301
- if (head2) {
45302
- const headSize2 = head2.Prop("Size");
45303
- const ogHeadSize2 = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head2);
45304
- let scale = divide(headSize2.toVec3(), ogHeadSize2.toVec3());
45305
- if (this.meshDesc.wasAutoSkinned) {
45306
- scale = [1, 1, 1];
45307
- }
45308
- jointCF.Position = multiply(jointCF.Position, scale);
45309
- }
45310
- let totalPosition = new Vector32();
45311
- let totalRotation = new Vector32();
45312
- for (let i = 0; i < facs.faceControlNames.length; i++) {
45313
- const faceControlName = facs.faceControlNames[i];
45314
- const col = i;
45315
- const row = j;
45316
- const cols = facs.faceControlNames.length;
45317
- const index = row * cols + col;
45318
- const posX = facs.quantizedTransforms.px.matrix[index];
45319
- const posY = facs.quantizedTransforms.py.matrix[index];
45320
- const posZ = facs.quantizedTransforms.pz.matrix[index];
45321
- const rotX = facs.quantizedTransforms.rx.matrix[index];
45322
- const rotY = facs.quantizedTransforms.ry.matrix[index];
45323
- const rotZ = facs.quantizedTransforms.rz.matrix[index];
45324
- const pos = new Vector32(posX, posY, posZ);
45325
- const rot = new Vector32(rotX, rotY, rotZ);
45326
- let weight = 0;
45327
- if (faceControlName.includes(" ")) {
45328
- weight = 1;
45329
- for (const faceControlSubname of faceControlName.split(" ")) {
45330
- const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45331
- weight *= faceControls.Prop(propertyName);
45332
- }
45333
- } else {
45334
- const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45335
- if (propertyName === void 0) {
45336
- log(false, faceControlName);
45337
- }
45338
- weight = faceControls.Prop(propertyName);
45339
- }
45340
- totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45341
- totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45342
- }
45343
- const resultCF = new CFrame();
45344
- const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "XYZ");
45345
- euler.reorder("YXZ");
45346
- resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45347
- resultCF.Position = multiply(totalPosition.toVec3(), headScale);
45348
- setTHREEObjectCF(bone, jointCF.multiply(resultCF));
45349
- break;
45433
+ isFACS(boneName) {
45434
+ return this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(boneName);
45435
+ }
45436
+ addFACS(restCF, bone, assembly) {
45437
+ const isFACS = this.isFACS(bone.name);
45438
+ if (!isFACS) return restCF;
45439
+ const facsMesh = this.meshDesc.fileMesh;
45440
+ const facs = this.meshDesc.fileMesh?.facs;
45441
+ const headNode = assembly.getNode("Head");
45442
+ if (headNode && facsMesh && facs && facs.quantizedTransforms) {
45443
+ const head = headNode.part;
45444
+ let faceControls = head.FindFirstChildOfClass("FaceControls");
45445
+ if (!faceControls) {
45446
+ faceControls = new Instance("FaceControls");
45447
+ faceControls.setParent(head);
45448
+ }
45449
+ new FaceControlsWrapper(faceControls);
45450
+ for (let j = 0; j < facs.faceBoneNames.length; j++) {
45451
+ const boneName = facs.faceBoneNames[j];
45452
+ if (boneName === bone.name) {
45453
+ let totalPosition = new Vector32();
45454
+ let totalRotation = new Vector32();
45455
+ for (let i = 0; i < facs.faceControlNames.length; i++) {
45456
+ const faceControlName = facs.faceControlNames[i];
45457
+ const col = i;
45458
+ const row = j;
45459
+ const cols = facs.faceControlNames.length;
45460
+ const index = row * cols + col;
45461
+ const posX = facs.quantizedTransforms.px.matrix[index];
45462
+ const posY = facs.quantizedTransforms.py.matrix[index];
45463
+ const posZ = facs.quantizedTransforms.pz.matrix[index];
45464
+ const rotX = facs.quantizedTransforms.rx.matrix[index];
45465
+ const rotY = facs.quantizedTransforms.ry.matrix[index];
45466
+ const rotZ = facs.quantizedTransforms.rz.matrix[index];
45467
+ const pos = new Vector32(posX, posY, posZ);
45468
+ const rot = new Vector32(rotX, rotY, rotZ);
45469
+ let weight = 0;
45470
+ if (faceControlName.includes(" ")) {
45471
+ weight = 1;
45472
+ for (const faceControlSubname of faceControlName.split(" ")) {
45473
+ const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45474
+ weight *= faceControls.Prop(propertyName);
45475
+ }
45476
+ } else {
45477
+ const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45478
+ if (propertyName === void 0) {
45479
+ log(false, faceControlName);
45350
45480
  }
45481
+ weight = faceControls.Prop(propertyName);
45351
45482
  }
45483
+ totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45484
+ totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45352
45485
  }
45486
+ const resultCF = new CFrame();
45487
+ const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "XYZ");
45488
+ euler.reorder("YXZ");
45489
+ resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45490
+ resultCF.Position = multiply(totalPosition.toVec3(), this.getScale(headNode).toVec3());
45491
+ return restCF.multiply(resultCF);
45353
45492
  }
45354
45493
  }
45355
45494
  }
45356
- this.updateMatrixWorld();
45357
- }
45358
- dispose(scene) {
45359
- if (this.skeletonHelper) {
45360
- scene.remove(this.skeletonHelper);
45361
- this.skeletonHelper.dispose();
45362
- this.skeletonHelper = void 0;
45363
- }
45364
- if (this.rootBone.parent) {
45365
- this.rootBone.parent.remove(this.rootBone);
45366
- }
45367
- for (let i = 0; i < this.skeleton.bones.length; i++) {
45368
- const bone = this.skeleton.bones[i];
45369
- if (bone.parent) {
45370
- bone.removeFromParent();
45371
- }
45372
- }
45373
- }
45374
- static descNeedsSkeleton(meshDesc) {
45375
- return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.subsets.length > 0 && meshDesc.fileMesh.skinning.skinnings.length > 0;
45376
- }
45377
- };
45378
- function setBoneToCFrame(bone, cf) {
45379
- bone.position.set(...cf.Position);
45380
- bone.rotation.order = "YXZ";
45381
- bone.rotation.x = rad(cf.Orientation[0]);
45382
- bone.rotation.y = rad(cf.Orientation[1]);
45383
- bone.rotation.z = rad(cf.Orientation[2]);
45384
- }
45385
- function getJointForInstances(child, includeTransform) {
45386
- const childMotor = child.FindFirstChildOfClass("Motor6D");
45387
- let transform = new CFrame();
45388
- if (childMotor) {
45389
- if (includeTransform) {
45390
- transform = childMotor.Prop("Transform");
45391
- return transform.inverse();
45392
- }
45393
- }
45394
- return new CFrame();
45395
- }
45396
- class SkeletonDesc2 {
45397
- renderableDesc;
45398
- meshDesc;
45399
- skeleton;
45400
- rootBone;
45401
- bones;
45402
- originalBoneCFrames = [];
45403
- originalHeadCFrame = new CFrame();
45404
- originalDynamicHeadCFrame = new CFrame();
45405
- skeletonHelper;
45406
- constructor(renderableDesc, meshDesc, scene) {
45407
- this.renderableDesc = renderableDesc;
45408
- this.meshDesc = meshDesc;
45409
- const mesh = this.meshDesc.fileMesh;
45410
- if (!mesh) {
45411
- throw new Error("MeshDesc is not compiled");
45412
- }
45413
- const skinning = mesh.skinning;
45414
- const boneArr = [];
45415
- for (let i = 0; i < skinning.bones.length; i++) {
45416
- const threeBone = new Bone();
45417
- threeBone.name = skinning.nameTable[i];
45418
- boneArr.push(threeBone);
45419
- }
45420
- this.bones = boneArr;
45421
- let rootBone = void 0;
45422
- for (let i = 0; i < skinning.bones.length; i++) {
45423
- const bone = skinning.bones[i];
45424
- const threeBone = boneArr[i];
45425
- if (bone.parentIndex < skinning.bones.length) {
45426
- const parentBone = skinning.bones[bone.parentIndex];
45427
- const parentThreeBone = boneArr[bone.parentIndex];
45428
- const worldParentBoneCF = new CFrame(...parentBone.position);
45429
- worldParentBoneCF.fromRotationMatrix(...parentBone.rotationMatrix);
45430
- const worldBoneCF = new CFrame(...bone.position);
45431
- worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45432
- const boneCF = worldParentBoneCF.inverse().multiply(worldBoneCF);
45433
- this.originalBoneCFrames.push(boneCF);
45434
- if (threeBone.name === "Head") {
45435
- this.originalHeadCFrame = boneCF;
45436
- } else if (threeBone.name === "DynamicHead") {
45437
- this.originalDynamicHeadCFrame = boneCF;
45438
- }
45439
- setBoneToCFrame(threeBone, boneCF);
45440
- parentThreeBone.add(threeBone);
45441
- } else {
45442
- rootBone = threeBone;
45443
- const worldBoneCF = new CFrame(...bone.position);
45444
- worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45445
- setBoneToCFrame(threeBone, worldBoneCF);
45446
- this.originalBoneCFrames.push(worldBoneCF);
45447
- }
45448
- }
45449
- if (!rootBone) {
45450
- throw new Error("FileMesh has no root bone");
45451
- } else {
45452
- if (rootBone && rootBone.name !== "Root") {
45453
- const trueRootBone = new Bone();
45454
- trueRootBone.name = "Root";
45455
- trueRootBone.position.set(0, 0, 0);
45456
- trueRootBone.rotation.set(0, 0, 0, "YXZ");
45457
- this.originalBoneCFrames.unshift(new CFrame());
45458
- this.bones.unshift(trueRootBone);
45459
- trueRootBone.add(rootBone);
45460
- rootBone = trueRootBone;
45461
- }
45462
- this.rootBone = rootBone;
45463
- }
45464
- this.skeleton = new Skeleton(boneArr);
45465
- this.setAsRest();
45466
- if (FLAGS.SHOW_SKELETON_HELPER) {
45467
- const skeletonHelper = new SkeletonHelper(this.rootBone);
45468
- scene.add(skeletonHelper);
45469
- this.skeletonHelper = skeletonHelper;
45470
- }
45471
- }
45472
- setAsRest() {
45473
- for (const bone of this.skeleton.bones) {
45474
- const boneIndex = this.skeleton.bones.indexOf(bone);
45475
- this.skeleton.boneInverses[boneIndex].copy(bone.matrixWorld).invert();
45476
- }
45477
- }
45478
- getPartEquivalent(selfInstance, name) {
45479
- if (!selfInstance.parent) return;
45480
- let partEquivalent = selfInstance.parent.FindFirstChild(name);
45481
- if (partEquivalent === void 0 && selfInstance.parent.parent) {
45482
- partEquivalent = selfInstance.parent.parent.FindFirstChild(name);
45483
- }
45484
- return partEquivalent;
45485
- }
45486
- getRootCFrame(instance, includeTransform) {
45487
- if (includeTransform) {
45488
- return instance.Prop("CFrame");
45489
- } else {
45490
- let bodyPart = void 0;
45491
- if (instance.parent && instance.parent.FindFirstChildOfClass("Humanoid")) {
45492
- bodyPart = instance;
45493
- } else if (instance.parent && instance.parent.parent && instance.parent.className === "Accessory") {
45494
- bodyPart = GetAttachedPart(instance.parent, instance.parent.parent);
45495
- }
45496
- const hrp = this.getPartEquivalent(instance, "HumanoidRootPart");
45497
- if (hrp && bodyPart) {
45498
- return hrp.Prop("CFrame").multiply(traverseRigCFrame(bodyPart));
45499
- }
45500
- }
45501
- return new CFrame();
45495
+ return restCF;
45502
45496
  }
45503
45497
  updateBoneMatrix(selfInstance, includeTransform = false) {
45504
45498
  if (!selfInstance.parent) return;
45505
45499
  if (!this.meshDesc.fileMesh) return;
45506
- const ogMeshSize = new Vector32(...this.meshDesc.fileMesh.size);
45507
- const scale = divide((this.meshDesc.instance?.Prop("Size")).toVec3(), ogMeshSize.toVec3());
45500
+ const w = selfInstance.w;
45501
+ if (!(w instanceof BasePartWrapper)) return;
45502
+ const assembly = w.GetAssembly();
45503
+ const boneWorldCFrameArr = new Array(this.bones.length);
45504
+ for (let i = 0; i < this.bones.length; i++) {
45505
+ const bone = this.bones[i];
45506
+ const boneWorldCFrame = this.getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform);
45507
+ boneWorldCFrameArr[i] = boneWorldCFrame;
45508
+ }
45508
45509
  for (let i = 0; i < this.bones.length; i++) {
45509
45510
  const bone = this.bones[i];
45510
- const partEquivalent = this.getPartEquivalent(selfInstance, bone.name);
45511
- const ogBoneCF = this.originalBoneCFrames[i].clone();
45512
- ogBoneCF.Position = multiply(ogBoneCF.Position, scale);
45513
- if (partEquivalent && includeTransform) {
45514
- setBoneToCFrame(bone, ogBoneCF.multiply(getJointForInstances(partEquivalent, includeTransform)));
45511
+ const boneWorldCFrame = boneWorldCFrameArr[i];
45512
+ let parentBone = bone.parent;
45513
+ if (!(parentBone instanceof Bone)) parentBone = null;
45514
+ if (bone && parentBone) {
45515
+ if ((boneIsChildOf(bone, "DynamicHead") || bone.name === "DynamicHead") && this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned) {
45516
+ const parentBoneWorldCFrame = this.getOriginalWorldCFrameNoChange(parentBone);
45517
+ const boneWorldCFrameNoChange = this.getOriginalWorldCFrameNoChange(bone);
45518
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrameNoChange);
45519
+ let scale = new Vector32(1, 1, 1);
45520
+ const headNode = assembly.getNode("Head");
45521
+ if (headNode) {
45522
+ scale = this.getScale(headNode);
45523
+ }
45524
+ diffCF.Position = multiply(diffCF.Position, scale.toVec3());
45525
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45526
+ setTHREEObjectCF(bone, diffCF);
45527
+ } else {
45528
+ const parentBoneWorldCFrame = boneWorldCFrameArr[this.bones.indexOf(parentBone)];
45529
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrame);
45530
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45531
+ setTHREEObjectCF(bone, diffCF);
45532
+ }
45515
45533
  } else {
45516
- setBoneToCFrame(bone, ogBoneCF);
45534
+ setTHREEObjectCF(bone, boneWorldCFrame);
45517
45535
  }
45518
45536
  }
45519
45537
  this.updateMatrixWorld();
@@ -45529,85 +45547,12 @@ class SkeletonDesc2 {
45529
45547
  }
45530
45548
  update(instance) {
45531
45549
  if (!FLAGS.UPDATE_SKELETON || !instance.parent || !this.meshDesc.fileMesh) return;
45532
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45533
45550
  this.updateBoneMatrix(instance);
45534
45551
  if (FLAGS.ANIMATE_SKELETON) {
45535
45552
  this.updateBoneMatrix(instance, true);
45536
- for (const bone of this.skeleton.bones) {
45537
- const isFACS = this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(bone.name);
45538
- if (isFACS) {
45539
- const facsMesh = this.meshDesc.fileMesh;
45540
- const facs = this.meshDesc.fileMesh?.facs;
45541
- const head = this.getPartEquivalent(instance, "Head");
45542
- if (head && facsMesh && facs && facs.quantizedTransforms) {
45543
- let faceControls = head.FindFirstChildOfClass("FaceControls");
45544
- if (!faceControls) {
45545
- faceControls = new Instance("FaceControls");
45546
- faceControls.setParent(head);
45547
- }
45548
- new FaceControlsWrapper(faceControls);
45549
- for (let j = 0; j < facs.faceBoneNames.length; j++) {
45550
- const boneName = facs.faceBoneNames[j];
45551
- if (boneName === bone.name) {
45552
- let jointCF = new CFrame();
45553
- const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)];
45554
- jointCF = ogCF.clone();
45555
- const head2 = this.getPartEquivalent(instance, "Head");
45556
- if (head2) {
45557
- const headSize = head2.Prop("Size");
45558
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head2);
45559
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45560
- if (this.meshDesc.wasAutoSkinned) {
45561
- scale = [1, 1, 1];
45562
- }
45563
- jointCF.Position = multiply(jointCF.Position, scale);
45564
- }
45565
- let totalPosition = new Vector32();
45566
- let totalRotation = new Vector32();
45567
- for (let i = 0; i < facs.faceControlNames.length; i++) {
45568
- const faceControlName = facs.faceControlNames[i];
45569
- const col = i;
45570
- const row = j;
45571
- const cols = facs.faceControlNames.length;
45572
- const index = row * cols + col;
45573
- const posX = facs.quantizedTransforms.px.matrix[index];
45574
- const posY = facs.quantizedTransforms.py.matrix[index];
45575
- const posZ = facs.quantizedTransforms.pz.matrix[index];
45576
- const rotX = facs.quantizedTransforms.rx.matrix[index];
45577
- const rotY = facs.quantizedTransforms.ry.matrix[index];
45578
- const rotZ = facs.quantizedTransforms.rz.matrix[index];
45579
- const pos = new Vector32(posX, posY, posZ);
45580
- const rot = new Vector32(rotX, rotY, rotZ);
45581
- let weight = 0;
45582
- if (faceControlName.includes(" ")) {
45583
- weight = 1;
45584
- for (const faceControlSubname of faceControlName.split(" ")) {
45585
- const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45586
- weight *= faceControls.Prop(propertyName);
45587
- }
45588
- } else {
45589
- const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45590
- if (propertyName === void 0) {
45591
- log(false, faceControlName);
45592
- }
45593
- weight = faceControls.Prop(propertyName);
45594
- }
45595
- totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45596
- totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45597
- }
45598
- const resultCF = new CFrame();
45599
- const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "YXZ");
45600
- resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45601
- resultCF.Position = totalPosition.toVec3();
45602
- setBoneToCFrame(bone, jointCF.multiply(resultCF));
45603
- break;
45604
- }
45605
- }
45606
- }
45607
- }
45608
- }
45609
45553
  }
45610
45554
  this.updateMatrixWorld();
45555
+ this.frameCount += 1;
45611
45556
  }
45612
45557
  dispose(scene) {
45613
45558
  if (this.skeletonHelper) {
@@ -45626,7 +45571,7 @@ class SkeletonDesc2 {
45626
45571
  }
45627
45572
  }
45628
45573
  static descNeedsSkeleton(meshDesc) {
45629
- return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.subsets.length > 0 && meshDesc.fileMesh.skinning.skinnings.length > 0;
45574
+ return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.numskinnings > 0;
45630
45575
  }
45631
45576
  }
45632
45577
  const PartTypes = ["Part", "WedgePart"];
@@ -45776,12 +45721,8 @@ class ObjectDesc extends RenderDesc {
45776
45721
  const oldSize = this.originalScale;
45777
45722
  threeMesh.scale.set(this.size.X / oldSize.x, this.size.Y / oldSize.y, this.size.Z / oldSize.z);
45778
45723
  }
45779
- if (SkeletonDesc$1.descNeedsSkeleton(this.meshDesc)) {
45780
- if (FLAGS.USE_LOCAL_SKELETONDESC) {
45781
- this.skeletonDesc = new SkeletonDesc2(this, this.meshDesc, scene);
45782
- } else {
45783
- this.skeletonDesc = new SkeletonDesc$1(this, this.meshDesc, scene);
45784
- }
45724
+ if (SkeletonDesc.descNeedsSkeleton(this.meshDesc)) {
45725
+ this.skeletonDesc = new SkeletonDesc(this, this.meshDesc, scene);
45785
45726
  } else {
45786
45727
  this.meshDesc.fileMesh = void 0;
45787
45728
  }
@@ -47089,7 +47030,8 @@ class AnimatorWrapper extends InstanceWrapper {
47089
47030
  const result = await API.Asset.GetRBX(`rbxassetid://${id}`, void 0);
47090
47031
  if (result instanceof RBX) {
47091
47032
  log(false, "loading anim", id);
47092
- const animTrackInstance = result.generateTree().GetChildren()[0];
47033
+ const dataModel = result.generateTree();
47034
+ const animTrackInstance = dataModel.GetChildren()[0];
47093
47035
  if (animTrackInstance && humanoid.parent) {
47094
47036
  const animTrack = new AnimationTrack().loadAnimation(humanoid.parent, animTrackInstance);
47095
47037
  if (forceLoop) {
@@ -47100,7 +47042,10 @@ class AnimatorWrapper extends InstanceWrapper {
47100
47042
  }
47101
47043
  this.data.animationTracks.set(id, animTrack);
47102
47044
  this.instance.setProperty("_HasLoadedAnimation", true);
47045
+ dataModel.Destroy();
47103
47046
  return animTrack;
47047
+ } else {
47048
+ dataModel.Destroy();
47104
47049
  }
47105
47050
  } else {
47106
47051
  return result;
@@ -47123,7 +47068,8 @@ class AnimatorWrapper extends InstanceWrapper {
47123
47068
  if (!(animationInfo instanceof RBX)) {
47124
47069
  return animationInfo;
47125
47070
  }
47126
- const root = animationInfo.generateTree().GetChildren()[0];
47071
+ const dataModel = animationInfo.generateTree();
47072
+ const root = dataModel.GetChildren()[0];
47127
47073
  const promises = [];
47128
47074
  if (!isEmote) {
47129
47075
  for (const anim of root.GetChildren()) {
@@ -47193,6 +47139,7 @@ class AnimatorWrapper extends InstanceWrapper {
47193
47139
  }
47194
47140
  }
47195
47141
  }
47142
+ dataModel.Destroy();
47196
47143
  }
47197
47144
  /**
47198
47145
  * Switches to new animation
@@ -47258,14 +47205,16 @@ class AttachmentWrapper extends InstanceWrapper {
47258
47205
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
47259
47206
  if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
47260
47207
  }
47261
- getWorldCFrame() {
47208
+ getWorldCFrame(includeTransform = true) {
47262
47209
  if (this.instance.parent) {
47263
47210
  if (this.instance.parent.w?.IsA("BasePart")) {
47264
47211
  const parentCF = this.instance.parent.PropOrDefault("CFrame", new CFrame());
47265
- return parentCF.multiply(this.instance.Prop("CFrame"));
47212
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47213
+ return parentCF.multiply(this.instance.Prop("CFrame")).multiply(transform);
47266
47214
  } else if (this.instance.parent.w?.IsA("Attachment")) {
47267
47215
  const w = this.instance.parent.w;
47268
- return w.getWorldCFrame().multiply(this.instance.Prop("CFrame"));
47216
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47217
+ return w.getWorldCFrame().multiply(this.instance.Prop("CFrame")).multiply(transform);
47269
47218
  }
47270
47219
  }
47271
47220
  return this.instance.Prop("CFrame");
@@ -47275,25 +47224,6 @@ const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47275
47224
  __proto__: null,
47276
47225
  AttachmentWrapper
47277
47226
  }, Symbol.toStringTag, { value: "Module" }));
47278
- class BasePartWrapper extends InstanceWrapper {
47279
- static className = "BasePart";
47280
- static requiredProperties = [
47281
- "Name",
47282
- "CFrame",
47283
- "size",
47284
- "Transparency"
47285
- ];
47286
- setup() {
47287
- if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
47288
- if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
47289
- if (!this.instance.HasProperty("size")) this.instance.addProperty(new Property("size", DataType.Vector3), new Vector32());
47290
- if (!this.instance.HasProperty("Transparency")) this.instance.addProperty(new Property("Transparency", DataType.Float32), 0);
47291
- }
47292
- }
47293
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47294
- __proto__: null,
47295
- BasePartWrapper
47296
- }, Symbol.toStringTag, { value: "Module" }));
47297
47227
  class BodyColorsWrapper extends InstanceWrapper {
47298
47228
  static className = "BodyColors";
47299
47229
  static requiredProperties = [
@@ -47373,6 +47303,21 @@ const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47373
47303
  __proto__: null,
47374
47304
  BodyPartDescriptionWrapper
47375
47305
  }, Symbol.toStringTag, { value: "Module" }));
47306
+ class BoneWrapper extends AttachmentWrapper {
47307
+ static className = "Bone";
47308
+ static requiredProperties = [
47309
+ ...super.requiredProperties,
47310
+ "Transform"
47311
+ ];
47312
+ setup() {
47313
+ super.setup();
47314
+ if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
47315
+ }
47316
+ }
47317
+ const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47318
+ __proto__: null,
47319
+ BoneWrapper
47320
+ }, Symbol.toStringTag, { value: "Module" }));
47376
47321
  class DecalWrapper extends InstanceWrapper {
47377
47322
  static className = "Decal";
47378
47323
  static requiredProperties = [
@@ -47394,7 +47339,7 @@ class DecalWrapper extends InstanceWrapper {
47394
47339
  if (!this.instance.HasProperty("UVScale")) this.instance.addProperty(new Property("UVScale", DataType.Vector2), new Vector22());
47395
47340
  }
47396
47341
  }
47397
- const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47342
+ const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47398
47343
  __proto__: null,
47399
47344
  DecalWrapper
47400
47345
  }, Symbol.toStringTag, { value: "Module" }));
@@ -47538,7 +47483,7 @@ class MakeupDescriptionWrapper extends InstanceWrapper {
47538
47483
  if (!this.instance.HasProperty("Instance")) this.instance.addProperty(new Property("Instance", DataType.Referent), void 0);
47539
47484
  }
47540
47485
  }
47541
- const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47486
+ const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47542
47487
  __proto__: null,
47543
47488
  MakeupDescriptionWrapper
47544
47489
  }, Symbol.toStringTag, { value: "Module" }));
@@ -48238,7 +48183,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48238
48183
  moveAttachmentsToBase(child);
48239
48184
  }
48240
48185
  for (const childChild of child.GetChildren()) {
48241
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48186
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48242
48187
  childChild.Destroy();
48243
48188
  }
48244
48189
  }
@@ -48276,10 +48221,13 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48276
48221
  const head2 = dataModel.FindFirstChildOfClass("MeshPart");
48277
48222
  if (head2) {
48278
48223
  for (const childChild of head2.GetChildren()) {
48279
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48224
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48280
48225
  childChild.Destroy();
48281
48226
  }
48282
48227
  }
48228
+ if (!FLAGS.AVATAR_JOINT_UPGRADE) {
48229
+ moveAttachmentsToBase(head2);
48230
+ }
48283
48231
  replaceBodyPart(rig, head2);
48284
48232
  }
48285
48233
  }
@@ -48293,6 +48241,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48293
48241
  }
48294
48242
  resolve(void 0);
48295
48243
  }
48244
+ dataModel.Destroy();
48296
48245
  }
48297
48246
  });
48298
48247
  }));
@@ -48349,6 +48298,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48349
48298
  }
48350
48299
  }
48351
48300
  }
48301
+ dataModel.Destroy();
48352
48302
  resolve(void 0);
48353
48303
  } else {
48354
48304
  resolve(result);
@@ -48392,9 +48342,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48392
48342
  }
48393
48343
  asset.setParent(rig);
48394
48344
  } else {
48395
- dataModel.Destroy();
48396
48345
  warn(false, `Clothing asset does not exist or is invalid`);
48397
48346
  }
48347
+ dataModel.Destroy();
48398
48348
  resolve(void 0);
48399
48349
  } else {
48400
48350
  resolve(rbx);
@@ -48450,9 +48400,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48450
48400
  face.setParent(head);
48451
48401
  }
48452
48402
  } else {
48453
- dataModel.Destroy();
48454
48403
  warn(false, `Face asset does not exist or is invalid`);
48455
48404
  }
48405
+ dataModel.Destroy();
48456
48406
  } else {
48457
48407
  return rbx;
48458
48408
  }
@@ -48498,32 +48448,34 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48498
48448
  if (oldTool) {
48499
48449
  oldTool.Destroy();
48500
48450
  }
48501
- const handle = tool.FindFirstChild("Handle");
48502
- for (const child of tool.GetDescendants()) {
48503
- if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
48504
- if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
48505
- const part0 = child.Prop("Part0");
48506
- const part1 = child.Prop("Part1");
48507
- const c0 = child.Prop("C0");
48508
- const c1 = child.Prop("C1");
48509
- child.setProperty("Part0", part1, true);
48510
- child.setProperty("Part1", part0, true);
48511
- child.setProperty("C0", c1, true);
48512
- child.setProperty("C1", c0);
48513
- } else if (child.HasProperty("Part0") && child.Prop("Part0") === handle) ;
48514
- else {
48515
- child.Destroy();
48516
- }
48517
- if (!child.destroyed && child.PropOrDefault("Part0", void 0) == void 0 || child.PropOrDefault("Part1", void 0) === void 0) {
48518
- child.Destroy();
48451
+ if (!FLAGS.USE_ASSEMBLY) {
48452
+ const handle = tool.FindFirstChild("Handle");
48453
+ for (const child of tool.GetDescendants()) {
48454
+ if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
48455
+ if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
48456
+ const part0 = child.Prop("Part0");
48457
+ const part1 = child.Prop("Part1");
48458
+ const c0 = child.Prop("C0");
48459
+ const c1 = child.Prop("C1");
48460
+ child.setProperty("Part0", part1, true);
48461
+ child.setProperty("Part1", part0, true);
48462
+ child.setProperty("C0", c1, true);
48463
+ child.setProperty("C1", c0);
48464
+ } else if (child.HasProperty("Part0") && child.Prop("Part0") === handle) ;
48465
+ else {
48466
+ child.Destroy();
48467
+ }
48468
+ if (!child.destroyed && child.PropOrDefault("Part0", void 0) == void 0 || child.PropOrDefault("Part1", void 0) === void 0) {
48469
+ child.Destroy();
48470
+ }
48519
48471
  }
48520
48472
  }
48521
48473
  }
48522
48474
  tool.setParent(rig);
48523
48475
  } else {
48524
- dataModel.Destroy();
48525
48476
  warn(false, `Gear asset does not exist or is invalid`);
48526
48477
  }
48478
+ dataModel.Destroy();
48527
48479
  } else {
48528
48480
  return rbx;
48529
48481
  }
@@ -48613,9 +48565,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48613
48565
  accessoryDesc.setProperty("Instance", accessory);
48614
48566
  }
48615
48567
  } else {
48616
- dataModel.Destroy();
48617
48568
  warn(false, `Accessory asset does not exist or is invalid`);
48618
48569
  }
48570
+ dataModel.Destroy();
48619
48571
  resolve(void 0);
48620
48572
  } else {
48621
48573
  resolve(rbx);
@@ -48699,9 +48651,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48699
48651
  makeupDesc.setProperty("Instance", makeup);
48700
48652
  }
48701
48653
  } else {
48702
- dataModel.Destroy();
48703
48654
  warn(false, `Makeup asset does not exist or is invalid`);
48704
48655
  }
48656
+ dataModel.Destroy();
48705
48657
  resolve(void 0);
48706
48658
  } else {
48707
48659
  resolve(rbx);
@@ -48909,17 +48861,17 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48909
48861
  return this.instance;
48910
48862
  }
48911
48863
  }
48912
- const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48864
+ const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48913
48865
  __proto__: null,
48914
48866
  HumanoidDescriptionWrapper
48915
48867
  }, Symbol.toStringTag, { value: "Module" }));
48916
- class WeldWrapperData {
48868
+ class JointInstanceWrapperData {
48917
48869
  part0ChangedConnection;
48918
48870
  lastUpdateTime = 0;
48919
48871
  timeUpdates = 0;
48920
48872
  }
48921
- class WeldWrapper extends InstanceWrapper {
48922
- static className = "Weld";
48873
+ class JointInstanceWrapper extends InstanceWrapper {
48874
+ static className = "JointInstance";
48923
48875
  static requiredProperties = [
48924
48876
  "Name",
48925
48877
  "Enabled",
@@ -48936,7 +48888,7 @@ class WeldWrapper extends InstanceWrapper {
48936
48888
  if (!this.instance.HasProperty("Part1")) this.instance.addProperty(new Property("Part1", DataType.Referent), void 0);
48937
48889
  if (!this.instance.HasProperty("C0")) this.instance.addProperty(new Property("C0", DataType.CFrame), new CFrame());
48938
48890
  if (!this.instance.HasProperty("C1")) this.instance.addProperty(new Property("C1", DataType.CFrame), new CFrame());
48939
- if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new WeldWrapperData());
48891
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new JointInstanceWrapperData());
48940
48892
  }
48941
48893
  get data() {
48942
48894
  return this.instance.Prop("_data");
@@ -48957,9 +48909,41 @@ class WeldWrapper extends InstanceWrapper {
48957
48909
  if (FLAGS.LEGACY_WELD_BEHAVIOR) return;
48958
48910
  const part0 = this.instance.Prop("Part0");
48959
48911
  const part1 = this.instance.Prop("Part1");
48960
- if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
48961
- part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48912
+ if (!FLAGS.USE_ASSEMBLY) {
48913
+ if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
48914
+ part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48915
+ }
48916
+ }
48917
+ }
48918
+ getAssemblyOffset(includeTransform) {
48919
+ const part0 = this.instance.Prop("Part0");
48920
+ const part1 = this.instance.Prop("Part1");
48921
+ if (part0 && part1 && part0 !== part1) {
48922
+ const part0W = part0.w;
48923
+ const part1W = part1.w;
48924
+ if (part0W && part1W && part0W.IsA("BasePart") && part1W.IsA("BasePart")) {
48925
+ const c0 = this.instance.Prop("C0");
48926
+ const c1 = this.instance.Prop("C1");
48927
+ const transform = this.instance.PropOrDefault("Transform", new CFrame());
48928
+ const an0 = part0W.GetAssemblyNode();
48929
+ const an1 = part1W.GetAssemblyNode();
48930
+ const affectedPart = an0.depth <= an1.depth ? 1 : 0;
48931
+ if (affectedPart === 1) {
48932
+ if (includeTransform) {
48933
+ return c0.multiply(c1.multiply(transform).inverse());
48934
+ } else {
48935
+ return c0.multiply(c1.inverse());
48936
+ }
48937
+ } else if (affectedPart === 0) {
48938
+ if (includeTransform) {
48939
+ return c1.multiply(transform).multiply(c0.inverse());
48940
+ } else {
48941
+ return c1.multiply(c0.inverse());
48942
+ }
48943
+ }
48944
+ }
48962
48945
  }
48946
+ return new CFrame();
48963
48947
  }
48964
48948
  update(affectedPart = 1) {
48965
48949
  if (!this.instance.parent) return;
@@ -49012,14 +48996,14 @@ class WeldWrapper extends InstanceWrapper {
49012
48996
  }
49013
48997
  }
49014
48998
  }
49015
- const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48999
+ const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49016
49000
  __proto__: null,
49017
- WeldWrapper
49001
+ JointInstanceWrapper
49018
49002
  }, Symbol.toStringTag, { value: "Module" }));
49019
- class ManualWeldWrapper extends WeldWrapper {
49003
+ class ManualWeldWrapper extends JointInstanceWrapper {
49020
49004
  static className = "ManualWeld";
49021
49005
  }
49022
- const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49006
+ const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49023
49007
  __proto__: null,
49024
49008
  ManualWeldWrapper
49025
49009
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49034,7 +49018,7 @@ class MeshPartWrapper extends BasePartWrapper {
49034
49018
  if (!this.instance.HasProperty("DoubleSided")) this.instance.addProperty(new Property("DoubleSided", DataType.Bool), false);
49035
49019
  }
49036
49020
  }
49037
- const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49021
+ const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49038
49022
  __proto__: null,
49039
49023
  MeshPartWrapper
49040
49024
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49053,11 +49037,11 @@ class ModelWrapper extends InstanceWrapper {
49053
49037
  throw new Error("Model has no PrimaryPart");
49054
49038
  }
49055
49039
  }
49056
- const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49040
+ const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49057
49041
  __proto__: null,
49058
49042
  ModelWrapper
49059
49043
  }, Symbol.toStringTag, { value: "Module" }));
49060
- class Motor6DWrapper extends WeldWrapper {
49044
+ class Motor6DWrapper extends JointInstanceWrapper {
49061
49045
  static className = "Motor6D";
49062
49046
  static requiredProperties = [
49063
49047
  ...super.requiredProperties,
@@ -49068,7 +49052,7 @@ class Motor6DWrapper extends WeldWrapper {
49068
49052
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
49069
49053
  }
49070
49054
  }
49071
- const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49055
+ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49072
49056
  __proto__: null,
49073
49057
  Motor6DWrapper
49074
49058
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49083,7 +49067,7 @@ class PartWrapper extends BasePartWrapper {
49083
49067
  if (!this.instance.HasProperty("shape")) this.instance.addProperty(new Property("shape", DataType.Enum), PartType.Block);
49084
49068
  }
49085
49069
  }
49086
- const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49070
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49087
49071
  __proto__: null,
49088
49072
  PartWrapper
49089
49073
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49186,7 +49170,7 @@ class SoundWrapper extends InstanceWrapper {
49186
49170
  }
49187
49171
  }
49188
49172
  }
49189
- const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49173
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49190
49174
  __proto__: null,
49191
49175
  SoundWrapper
49192
49176
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49251,7 +49235,7 @@ class ScriptWrapper extends InstanceWrapper {
49251
49235
  }
49252
49236
  }
49253
49237
  }
49254
- const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49238
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49255
49239
  __proto__: null,
49256
49240
  ScriptWrapper
49257
49241
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49308,18 +49292,25 @@ class ToolWrapper extends InstanceWrapper {
49308
49292
  }
49309
49293
  }
49310
49294
  }
49311
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49295
+ const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49312
49296
  __proto__: null,
49313
49297
  ToolWrapper
49314
49298
  }, Symbol.toStringTag, { value: "Module" }));
49315
49299
  class WedgePartWrapper extends BasePartWrapper {
49316
49300
  static className = "WedgePart";
49317
49301
  }
49318
- const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49302
+ const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49319
49303
  __proto__: null,
49320
49304
  WedgePartWrapper
49321
49305
  }, Symbol.toStringTag, { value: "Module" }));
49322
- const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Decal.ts": __vite_glob_0_8, "./instance/FaceControls.ts": __vite_glob_0_9, "./instance/HumanoidDescription.ts": __vite_glob_0_10, "./instance/InstanceWrapper.ts": __vite_glob_0_11, "./instance/MakeupDescription.ts": __vite_glob_0_12, "./instance/ManualWeld.ts": __vite_glob_0_13, "./instance/MeshPart.ts": __vite_glob_0_14, "./instance/Model.ts": __vite_glob_0_15, "./instance/Motor6D.ts": __vite_glob_0_16, "./instance/Part.ts": __vite_glob_0_17, "./instance/Script.ts": __vite_glob_0_18, "./instance/Sound.ts": __vite_glob_0_19, "./instance/Tool.ts": __vite_glob_0_20, "./instance/WedgePart.ts": __vite_glob_0_21, "./instance/Weld.ts": __vite_glob_0_22 });
49306
+ class WeldWrapper extends JointInstanceWrapper {
49307
+ static className = "Weld";
49308
+ }
49309
+ const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49310
+ __proto__: null,
49311
+ WeldWrapper
49312
+ }, Symbol.toStringTag, { value: "Module" }));
49313
+ const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Constraint.ts": __vite_glob_0_9, "./instance/Decal.ts": __vite_glob_0_10, "./instance/FaceControls.ts": __vite_glob_0_11, "./instance/HumanoidDescription.ts": __vite_glob_0_12, "./instance/InstanceWrapper.ts": __vite_glob_0_13, "./instance/JointInstance.ts": __vite_glob_0_14, "./instance/MakeupDescription.ts": __vite_glob_0_15, "./instance/ManualWeld.ts": __vite_glob_0_16, "./instance/MeshPart.ts": __vite_glob_0_17, "./instance/Model.ts": __vite_glob_0_18, "./instance/Motor6D.ts": __vite_glob_0_19, "./instance/Part.ts": __vite_glob_0_20, "./instance/Script.ts": __vite_glob_0_21, "./instance/Sound.ts": __vite_glob_0_22, "./instance/Tool.ts": __vite_glob_0_23, "./instance/WedgePart.ts": __vite_glob_0_24, "./instance/Weld.ts": __vite_glob_0_25 });
49323
49314
  function RegisterWrappers() {
49324
49315
  for (const module of Object.values(modules$1)) {
49325
49316
  for (const exprt of Object.values(module)) {
@@ -49381,7 +49372,9 @@ const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
49381
49372
  __proto__: null,
49382
49373
  AttachmentDesc
49383
49374
  }, Symbol.toStringTag, { value: "Module" }));
49384
- const particle_vertexShader = `
49375
+ const particle_vertexShader = (
49376
+ /*glsl*/
49377
+ `
49385
49378
  attribute vec3 instanceColor;
49386
49379
  attribute vec3 instanceSeedTime;
49387
49380
  attribute float instanceOpacity;
@@ -49406,13 +49399,18 @@ void main() {
49406
49399
 
49407
49400
  vec4 modelViewPosition = modelViewMatrix * instanceMatrix * vec4(position, 1.0);
49408
49401
 
49402
+ //offset position toward camera
49409
49403
  vec3 viewDir = normalize(modelViewPosition.xyz);
49410
49404
  modelViewPosition.xyz += viewDir * -uZOffset;
49411
49405
 
49412
49406
  gl_Position = projectionMatrix * modelViewPosition;
49413
49407
  }
49414
- `;
49415
- const particle_fragmentShader = `
49408
+ `
49409
+ );
49410
+ const particle_fragmentShader = (
49411
+ /*glsl*/
49412
+ `
49413
+ //artibutes
49416
49414
  varying vec2 vUv;
49417
49415
  varying vec3 vInstanceColor;
49418
49416
  varying float vInstanceOpacity;
@@ -49420,12 +49418,25 @@ varying vec3 vInstanceSeedTime;
49420
49418
  varying vec2 vFlipbookUv0;
49421
49419
  varying vec2 vFlipbookUv1;
49422
49420
 
49421
+ //textures
49423
49422
  uniform sampler2D uColorMap;
49424
49423
  uniform sampler2D uAlphaMap;
49425
49424
  uniform sampler2D uMap;
49425
+
49426
+ //uniforms
49427
+ uniform float uLightInfluence;
49426
49428
  uniform float uOpacity;
49427
49429
  uniform vec2 uFlipbookSize;
49428
49430
 
49431
+ //light uniforms
49432
+ struct DirectionalLight {
49433
+ vec3 direction;
49434
+ vec3 color;
49435
+ };
49436
+ uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];
49437
+
49438
+ uniform vec3 ambientLightColor;
49439
+
49429
49440
  void main() {
49430
49441
  float seed = vInstanceSeedTime.x;
49431
49442
  float time = vInstanceSeedTime.y;
@@ -49453,12 +49464,25 @@ void main() {
49453
49464
  vec4 finalColor = opacityColor;
49454
49465
  finalColor.rgb = mix(opacityColor.rgb, opacityColor.rgb * colorTex.rgb, colorTex.a);
49455
49466
 
49467
+ // Apply lighting
49468
+ vec3 light = ambientLightColor;
49469
+ #if NUM_DIR_LIGHTS > 0
49470
+ for (int i = 0; i < NUM_DIR_LIGHTS; i++) {
49471
+ light += directionalLights[i].color;
49472
+ }
49473
+ #endif
49474
+
49475
+ finalColor = vec4(mix(finalColor.rgb, finalColor.rgb * light, uLightInfluence), finalColor.a);
49476
+
49456
49477
  gl_FragColor = finalColor;
49457
49478
  }
49458
- `;
49479
+ `
49480
+ );
49459
49481
  const particle_fragmentShader_additive = particle_fragmentShader.replace(
49460
49482
  "//#ADDITIVE_INSERT",
49461
- `if (opacityColor.r + opacityColor.g + opacityColor.b <= 0.05) {
49483
+ /*glsl*/
49484
+ `
49485
+ if (opacityColor.r + opacityColor.g + opacityColor.b <= 0.05) {
49462
49486
  discard;
49463
49487
  }`
49464
49488
  );
@@ -49624,6 +49648,7 @@ class EmitterDesc extends DisposableDesc {
49624
49648
  shapeInOut = 0;
49625
49649
  opacity = 1;
49626
49650
  lightEmission = 1;
49651
+ lightInfluence = 0;
49627
49652
  blending = AdditiveBlending;
49628
49653
  color = new ColorSequence();
49629
49654
  size = new NumberSequence();
@@ -49660,7 +49685,7 @@ class EmitterDesc extends DisposableDesc {
49660
49685
  return this.texture === other.texture && this.alphaTexture === other.alphaTexture && this.colorTexture === other.colorTexture && this.rate === other.rate;
49661
49686
  }
49662
49687
  isSame(other) {
49663
- return !this.needsRegeneration(other) && this.lockedToPart === other.lockedToPart && this.lifetime.isSame(other.lifetime) && this.spreadAngle.isSame(other.spreadAngle) && this.speed.isSame(other.speed) && this.rotation.isSame(other.rotation) && this.rotationSpeed.isSame(other.rotationSpeed) && this.localAcceleration.isSame(other.localAcceleration) && this.acceleration.isSame(other.acceleration) && this.drag === other.drag && this.timeScale === other.timeScale && this.orientation === other.orientation && this.zOffset === other.zOffset && this.offset.isSame(other.offset) && this.shapeInOut === other.shapeInOut && this.opacity === other.opacity && this.lightEmission === other.lightEmission && this.blending === other.blending && this.color.isSame(other.color) && this.size.isSame(other.size) && this.squash.isSame(other.squash) && this.transparency.isSame(other.transparency) && this.normalizeSizeKeypointTime === other.normalizeSizeKeypointTime && this.flipbookLayout === other.flipbookLayout && this.flipbookBlendFrames === other.flipbookBlendFrames && this.flipbookFramerate.isSame(other.flipbookFramerate) && this.flipbookMode === other.flipbookMode && this.flipbookSizeX === other.flipbookSizeX && this.flipbookSizeY === other.flipbookSizeY && this.flipbookStartRandom === other.flipbookStartRandom;
49688
+ return !this.needsRegeneration(other) && this.lockedToPart === other.lockedToPart && this.lifetime.isSame(other.lifetime) && this.spreadAngle.isSame(other.spreadAngle) && this.speed.isSame(other.speed) && this.rotation.isSame(other.rotation) && this.rotationSpeed.isSame(other.rotationSpeed) && this.localAcceleration.isSame(other.localAcceleration) && this.acceleration.isSame(other.acceleration) && this.drag === other.drag && this.timeScale === other.timeScale && this.orientation === other.orientation && this.zOffset === other.zOffset && this.offset.isSame(other.offset) && this.shapeInOut === other.shapeInOut && this.opacity === other.opacity && this.lightEmission === other.lightEmission && this.lightInfluence === other.lightInfluence && this.blending === other.blending && this.color.isSame(other.color) && this.size.isSame(other.size) && this.squash.isSame(other.squash) && this.transparency.isSame(other.transparency) && this.normalizeSizeKeypointTime === other.normalizeSizeKeypointTime && this.flipbookLayout === other.flipbookLayout && this.flipbookBlendFrames === other.flipbookBlendFrames && this.flipbookFramerate.isSame(other.flipbookFramerate) && this.flipbookMode === other.flipbookMode && this.flipbookSizeX === other.flipbookSizeX && this.flipbookSizeY === other.flipbookSizeY && this.flipbookStartRandom === other.flipbookStartRandom;
49664
49689
  }
49665
49690
  fromEmitterDesc(other) {
49666
49691
  this.lockedToPart = other.lockedToPart;
@@ -49680,6 +49705,7 @@ class EmitterDesc extends DisposableDesc {
49680
49705
  this.shapeInOut = other.shapeInOut;
49681
49706
  this.opacity = other.opacity;
49682
49707
  this.lightEmission = other.lightEmission;
49708
+ this.lightInfluence = other.lightInfluence;
49683
49709
  this.blending = other.blending;
49684
49710
  this.color = other.color.clone();
49685
49711
  this.size = other.size.clone();
@@ -49777,16 +49803,21 @@ class EmitterDesc extends DisposableDesc {
49777
49803
  side: DoubleSide,
49778
49804
  blending: this.blending,
49779
49805
  opacity: this.opacity,
49806
+ lights: true,
49780
49807
  vertexShader: particle_vertexShader,
49781
49808
  fragmentShader: this.blending === AdditiveBlending ? particle_fragmentShader_additive : particle_fragmentShader,
49782
- uniforms: {
49783
- uMap: { value: mapToUse },
49784
- uAlphaMap: { value: alphaMapToUse },
49785
- uColorMap: { value: colorMapToUse },
49786
- uOpacity: { value: this.opacity },
49787
- uZOffset: { value: this.zOffset },
49788
- uFlipbookSize: { value: new Vector2$1(1 / flipbookSizeX, 1 / flipbookSizeY) }
49789
- }
49809
+ uniforms: UniformsUtils.merge([
49810
+ UniformsLib.lights,
49811
+ {
49812
+ uMap: { value: mapToUse },
49813
+ uAlphaMap: { value: alphaMapToUse },
49814
+ uColorMap: { value: colorMapToUse },
49815
+ uLightInfluence: { value: this.lightInfluence },
49816
+ uOpacity: { value: this.opacity },
49817
+ uZOffset: { value: this.zOffset },
49818
+ uFlipbookSize: { value: new Vector2$1(1 / flipbookSizeX, 1 / flipbookSizeY) }
49819
+ }
49820
+ ])
49790
49821
  });
49791
49822
  this.resultMaterial = material;
49792
49823
  this.result = new InstancedMesh(geometry, material, this.maxCount);
@@ -49879,7 +49910,9 @@ class EmitterDesc extends DisposableDesc {
49879
49910
  if (this.resultMaterial) {
49880
49911
  this.resultMaterial.uniforms.uOpacity.value = this.opacity;
49881
49912
  this.resultMaterial.uniforms.uZOffset.value = this.zOffset;
49913
+ this.resultMaterial.uniforms.uLightInfluence.value = this.lightInfluence;
49882
49914
  this.resultMaterial.uniforms.uFlipbookSize.value.set(1 / flipbookSizeX, 1 / flipbookSizeY);
49915
+ this.resultMaterial.needsUpdate = true;
49883
49916
  }
49884
49917
  for (let i = 0; i < this.result.count; i++) {
49885
49918
  const particle = this.particles[i];
@@ -50061,6 +50094,7 @@ class EmitterGroupDesc extends RenderDesc {
50061
50094
  if (child.HasProperty("Transparency")) emitterDesc.transparency = child.Prop("Transparency");
50062
50095
  if (child.HasProperty("LightEmission")) emitterDesc.lightEmission = child.Prop("LightEmission");
50063
50096
  emitterDesc.blending = emitterDesc.lightEmission === 0 ? NormalBlending : AdditiveBlending;
50097
+ if (child.HasProperty("LightInfluence")) emitterDesc.lightInfluence = child.Prop("LightInfluence");
50064
50098
  if (child.HasProperty("ZOffset")) emitterDesc.zOffset = child.Prop("ZOffset");
50065
50099
  if (child.HasProperty("Orientation")) emitterDesc.orientation = child.Prop("Orientation");
50066
50100
  if (child.HasProperty("LockedToPart")) emitterDesc.lockedToPart = child.Prop("LockedToPart");
@@ -50179,7 +50213,8 @@ class EmitterGroupDesc extends RenderDesc {
50179
50213
  lifetime: new NumberRange(5, 5),
50180
50214
  timeScale,
50181
50215
  color: ColorSequence.fromColor(color),
50182
- blending: NormalBlending
50216
+ blending: NormalBlending,
50217
+ lightInfluence: 1
50183
50218
  }));
50184
50219
  }
50185
50220
  dispose(renderer, scene) {
@@ -51460,7 +51495,10 @@ class OutfitRenderer {
51460
51495
  this.currentRigType = newRigType;
51461
51496
  API.Asset.GetRBX(`roavatar://Rig${this.currentRigType}.rbxm`, void 0).then((result) => {
51462
51497
  if (result instanceof RBX) {
51463
- const newRig = result.generateTree().GetChildren()[0];
51498
+ const dataModel = result.generateTree();
51499
+ const newRig = dataModel.GetChildren()[0];
51500
+ newRig.setParent(void 0);
51501
+ dataModel.Destroy();
51464
51502
  this.currentRig = newRig;
51465
51503
  this.currentlyChangingRig = false;
51466
51504
  RBXRenderer.addInstance(this.currentRig, this.auth, this.renderScene);
@@ -51765,6 +51803,8 @@ export {
51765
51803
  AnimationPropToName,
51766
51804
  AnimationTrack,
51767
51805
  AnimatorWrapper,
51806
+ Assembly,
51807
+ AssemblyNode,
51768
51808
  Asset,
51769
51809
  AssetMeta,
51770
51810
  AssetType,
@@ -51775,6 +51815,7 @@ export {
51775
51815
  AttachmentWrapper,
51776
51816
  Authentication,
51777
51817
  AvatarType,
51818
+ BasePartWrapper,
51778
51819
  BodyColor3s,
51779
51820
  BodyColors,
51780
51821
  BodyColorsWrapper,
@@ -51782,6 +51823,7 @@ export {
51782
51823
  BodyPartDescriptionWrapper,
51783
51824
  BodyPartEnumToNames,
51784
51825
  BodyPartNameToEnum,
51826
+ BoneWrapper,
51785
51827
  BrickColors,
51786
51828
  BuildJoints,
51787
51829
  BundleTypes,
@@ -51795,6 +51837,7 @@ export {
51795
51837
  ColorSequence,
51796
51838
  ColorSequenceKeypoint,
51797
51839
  Connection,
51840
+ ConstraintWrapper,
51798
51841
  Content,
51799
51842
  ContentMap,
51800
51843
  DataType,
@@ -51810,7 +51853,6 @@ export {
51810
51853
  FaceControlsWrapper,
51811
51854
  FileMesh,
51812
51855
  FileMeshBone,
51813
- FileMeshSkinning,
51814
51856
  FileMeshSubset,
51815
51857
  FindFirstMatchingAttachment,
51816
51858
  FullBodyColors,
@@ -51824,6 +51866,7 @@ export {
51824
51866
  InstanceWrapper,
51825
51867
  ItemInfo,
51826
51868
  ItemSort,
51869
+ JointInstanceWrapper,
51827
51870
  LODS,
51828
51871
  LayeredAssetTypes,
51829
51872
  LayeredClothingAssetOrder,
@@ -51834,6 +51877,7 @@ export {
51834
51877
  ManualWeldWrapper,
51835
51878
  MaxOneOfAssetTypes,
51836
51879
  MaxPerAsset,
51880
+ MeshPartWrapper,
51837
51881
  MeshType,
51838
51882
  ModelWrapper,
51839
51883
  Motor6DWrapper,
@@ -51846,6 +51890,7 @@ export {
51846
51890
  OutfitOrigin,
51847
51891
  OutfitRenderer,
51848
51892
  PartType,
51893
+ PartWrapper,
51849
51894
  ParticleEmitterShapeInOut,
51850
51895
  ParticleFlipbookLayout,
51851
51896
  ParticleFlipbookMode,
@@ -51884,6 +51929,7 @@ export {
51884
51929
  Vector32 as Vector3,
51885
51930
  Wait,
51886
51931
  WearableAssetTypes,
51932
+ WedgePartWrapper,
51887
51933
  WeldWrapper,
51888
51934
  WorkerTypeToFunction,
51889
51935
  WrapLayerAutoSkin,
@@ -51945,8 +51991,11 @@ export {
51945
51991
  getOriginalAttachmentOrientation,
51946
51992
  getOriginalAttachmentPosition,
51947
51993
  getOriginalSize,
51994
+ getPartAssemblyScore,
51995
+ getPartsInAssembly_Generate,
51948
51996
  getRandomBetweenInclusive,
51949
51997
  getRigExtentsWorld,
51998
+ getRootAssemblyPart_Generate,
51950
51999
  getThumbnailCameraCFrame,
51951
52000
  getUVtoIndexMap,
51952
52001
  getUVtoIndicesMap,