roavatar-renderer 1.5.8 → 1.5.10

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,14 +29858,15 @@ 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,
29940
29864
  THUMBNAIL_TIMEOUT: 500,
29941
29865
  ALWAYS_SHOW_ATTACHMENTS: false,
29866
+ RENDERER_DELTA_TIME_MULTIPLIER: 1,
29942
29867
  //skeleton
29943
29868
  SHOW_SKELETON_HELPER: false,
29869
+ SKELETON_HELPER_INSTANCE_NAME: void 0,
29944
29870
  UPDATE_SKELETON: true,
29945
29871
  ANIMATE_SKELETON: true,
29946
29872
  AUTO_SKIN_EVERYTHING: false,
@@ -30001,10 +29927,12 @@ class InstanceWrapper {
30001
29927
  if (this.instance.className !== this.static().className) {
30002
29928
  throw new Error(`Provided Instance is not a ${this.static().className}`);
30003
29929
  }
29930
+ if (this.instance.wrapperInitialized) return;
30004
29931
  const propertyNames = this.instance.getPropertyNames();
30005
29932
  const hasAllProperties = this.static().requiredProperties.every((value) => propertyNames.includes(value));
30006
29933
  if (!hasAllProperties) {
30007
29934
  this.setup();
29935
+ this.instance.wrapperInitialized = true;
30008
29936
  const newPropertyNames = this.instance.getPropertyNames();
30009
29937
  const hasAllProperties2 = this.static().requiredProperties.every((value) => newPropertyNames.includes(value));
30010
29938
  if (!hasAllProperties2) {
@@ -30052,7 +29980,7 @@ class InstanceWrapper {
30052
29980
  preRender() {
30053
29981
  }
30054
29982
  }
30055
- const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29983
+ const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30056
29984
  __proto__: null,
30057
29985
  GetWrapperForInstance,
30058
29986
  InstanceWrapper
@@ -30541,6 +30469,7 @@ class Instance {
30541
30469
  parent = void 0;
30542
30470
  destroyed = false;
30543
30471
  _hasWrappered = false;
30472
+ wrapperInitialized = false;
30544
30473
  //private _canGC: boolean = true
30545
30474
  classID;
30546
30475
  //dont use this to identify instance class, it is only used during file loading
@@ -30551,6 +30480,7 @@ class Instance {
30551
30480
  Destroying = new Event();
30552
30481
  Changed = new Event();
30553
30482
  AncestryChanged = new Event();
30483
+ referencedByChanged = new Event();
30554
30484
  constructor(className, notComplete = false) {
30555
30485
  this._id = lastInstanceId;
30556
30486
  lastInstanceId++;
@@ -30600,6 +30530,7 @@ class Instance {
30600
30530
  if (!this._referencedBy.includes(instance)) {
30601
30531
  this._referencedBy.push(instance);
30602
30532
  }
30533
+ this.referencedByChanged.Fire();
30603
30534
  }
30604
30535
  removeReferencedBy(instance) {
30605
30536
  const index = this._referencedBy.indexOf(instance);
@@ -30613,9 +30544,13 @@ class Instance {
30613
30544
  }
30614
30545
  if (!isReferenced) {
30615
30546
  this._referencedBy.splice(index, 1);
30547
+ this.referencedByChanged.Fire();
30616
30548
  }
30617
30549
  }
30618
30550
  }
30551
+ getReferencedBy() {
30552
+ return [...this._referencedBy];
30553
+ }
30619
30554
  addProperty(property, value) {
30620
30555
  if (!property.name) {
30621
30556
  error(property);
@@ -30788,6 +30723,7 @@ class Instance {
30788
30723
  this.parent = instance;
30789
30724
  if (originalParent && originalParent !== instance) {
30790
30725
  originalParent.ChildRemoved.Fire(this);
30726
+ originalParent.AncestryChanged.Fire(this);
30791
30727
  }
30792
30728
  if (instance) {
30793
30729
  instance._children.push(this);
@@ -30811,6 +30747,7 @@ class Instance {
30811
30747
  this.Destroying.Clear();
30812
30748
  this.Changed.Clear();
30813
30749
  this.AncestryChanged.Clear();
30750
+ this.referencedByChanged.Clear();
30814
30751
  this.setParent(null);
30815
30752
  for (const child of this.GetChildren()) {
30816
30753
  child.Destroy();
@@ -30818,7 +30755,7 @@ class Instance {
30818
30755
  for (const property of this.getPropertyNames()) {
30819
30756
  this.setProperty(property, null);
30820
30757
  }
30821
- for (const instance of this._referencedBy) {
30758
+ for (const instance of this.getReferencedBy()) {
30822
30759
  for (const propertyName of instance.getPropertyNames()) {
30823
30760
  if (instance.Property(propertyName) === this) {
30824
30761
  instance.setProperty(propertyName, null);
@@ -30892,6 +30829,13 @@ class Instance {
30892
30829
  }
30893
30830
  return lastChild;
30894
30831
  }
30832
+ IsA(className) {
30833
+ const wrapper = this.w;
30834
+ if (wrapper) {
30835
+ return wrapper.IsA(className);
30836
+ }
30837
+ return false;
30838
+ }
30895
30839
  preRender() {
30896
30840
  const wrapper = GetWrapperForInstance(this);
30897
30841
  if (wrapper) {
@@ -34550,6 +34494,7 @@ class HSRAVIS {
34550
34494
  }
34551
34495
  }
34552
34496
  class FileMeshBone {
34497
+ name;
34553
34498
  boneNameIndex = 0;
34554
34499
  //uint
34555
34500
  parentIndex = 0;
@@ -34561,14 +34506,24 @@ class FileMeshBone {
34561
34506
  rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
34562
34507
  //3x3, world space, y up, -z forward
34563
34508
  position = [0, 0, 0];
34509
+ //metadata so skeletondesc knows what autoskin has done
34510
+ sourcePart;
34511
+ sourceOffset = new CFrame();
34512
+ sourceSize;
34513
+ sourceScaled = [1, 1, 1];
34564
34514
  clone() {
34565
34515
  const copy = new FileMeshBone();
34516
+ copy.name = this.name;
34566
34517
  copy.boneNameIndex = this.boneNameIndex;
34567
34518
  copy.parentIndex = this.parentIndex;
34568
34519
  copy.lodParentIndex = this.lodParentIndex;
34569
34520
  copy.culling = this.culling;
34570
34521
  copy.rotationMatrix = clonePrimitiveArray(this.rotationMatrix);
34571
34522
  copy.position = clonePrimitiveArray(this.position);
34523
+ copy.sourcePart = this.sourcePart;
34524
+ copy.sourceOffset = this.sourceOffset.clone();
34525
+ if (this.sourceSize) copy.sourceSize = clonePrimitiveArray(this.sourceSize);
34526
+ copy.sourceScaled = clonePrimitiveArray(this.sourceScaled);
34572
34527
  return copy;
34573
34528
  }
34574
34529
  }
@@ -34596,71 +34551,105 @@ class FileMeshSubset {
34596
34551
  return copy;
34597
34552
  }
34598
34553
  }
34599
- class FileMeshSkinning {
34600
- subsetIndices = [0, 0, 0, 0];
34601
- //byte[4]
34602
- boneWeights = [0, 0, 0, 0];
34603
- //byte[4]
34604
- clone() {
34605
- const copy = new FileMeshSkinning();
34606
- copy.subsetIndices = clonePrimitiveArray(this.subsetIndices);
34607
- copy.boneWeights = clonePrimitiveArray(this.boneWeights);
34608
- return copy;
34609
- }
34610
- }
34611
34554
  class SKINNING {
34612
- numSkinnings = 0;
34613
- //uint (same as numVerts)
34614
- skinnings = [];
34615
- //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
34616
- numBones = 0;
34617
- //uint
34555
+ _numskinnings = 0;
34556
+ _indices = new Uint16Array();
34557
+ _weights = new Float32Array();
34618
34558
  bones = [];
34619
- //FileMeshBone[]
34620
- nameTableSize = 0;
34621
- //uint
34622
- nameTable = [];
34623
- //string[]
34624
- numSubsets = 0;
34625
- //uint
34626
- subsets = [];
34627
- //FileMeshSubset[]
34628
34559
  clone() {
34629
34560
  const copy = new SKINNING();
34630
- copy.numSkinnings = this.numSkinnings;
34631
- copy.skinnings = new Array(this.skinnings.length);
34632
- for (let i = 0; i < this.skinnings.length; i++) {
34633
- copy.skinnings[i] = this.skinnings[i].clone();
34634
- }
34635
- copy.numBones = this.numBones;
34561
+ copy._numskinnings = this._numskinnings;
34562
+ copy._indices = this._indices.slice();
34563
+ copy._weights = this._weights.slice();
34636
34564
  copy.bones = new Array(this.bones.length);
34637
34565
  for (let i = 0; i < this.bones.length; i++) {
34638
34566
  copy.bones[i] = this.bones[i].clone();
34639
34567
  }
34640
- copy.nameTableSize = this.nameTableSize;
34641
- copy.nameTable = clonePrimitiveArray(this.nameTable);
34642
- copy.numSubsets = this.numSubsets;
34643
- copy.subsets = new Array(this.subsets.length);
34644
- for (let i = 0; i < this.subsets.length; i++) {
34645
- copy.subsets[i] = this.subsets[i].clone();
34646
- }
34647
34568
  return copy;
34648
34569
  }
34649
- getBone(boneName) {
34650
- const boneIndex = this.nameTable.indexOf(boneName);
34651
- if (boneIndex > -1) {
34652
- return this.bones[boneIndex];
34570
+ get numskinnings() {
34571
+ return this._numskinnings;
34572
+ }
34573
+ set numskinnings(value) {
34574
+ this._numskinnings = value;
34575
+ this._indices = new Uint16Array(value * 4);
34576
+ this._weights = new Float32Array(value * 4);
34577
+ }
34578
+ get indices() {
34579
+ return this._indices;
34580
+ }
34581
+ get weights() {
34582
+ return this._weights;
34583
+ }
34584
+ getIndex(i) {
34585
+ return [
34586
+ this._indices[i * 4 + 0],
34587
+ this._indices[i * 4 + 1],
34588
+ this._indices[i * 4 + 2],
34589
+ this._indices[i * 4 + 3]
34590
+ ];
34591
+ }
34592
+ setIndex(i, value) {
34593
+ this._indices[i * 4 + 0] = value[0];
34594
+ this._indices[i * 4 + 1] = value[1];
34595
+ this._indices[i * 4 + 2] = value[2];
34596
+ this._indices[i * 4 + 3] = value[3];
34597
+ }
34598
+ getWeight(i) {
34599
+ return [
34600
+ this._weights[i * 4 + 0],
34601
+ this._weights[i * 4 + 1],
34602
+ this._weights[i * 4 + 2],
34603
+ this._weights[i * 4 + 3]
34604
+ ];
34605
+ }
34606
+ setWeight(i, value) {
34607
+ this._weights[i * 4 + 0] = value[0];
34608
+ this._weights[i * 4 + 1] = value[1];
34609
+ this._weights[i * 4 + 2] = value[2];
34610
+ this._weights[i * 4 + 3] = value[3];
34611
+ }
34612
+ readSkinning(view, i) {
34613
+ this.setIndex(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34614
+ this.setWeight(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34615
+ }
34616
+ increaseSkinnings(add2) {
34617
+ const newSize = this.numskinnings + add2;
34618
+ const ogIndices = this._indices;
34619
+ const ogWeights = this._weights;
34620
+ this.numskinnings = newSize;
34621
+ this._indices.set(ogIndices);
34622
+ this._weights.set(ogWeights);
34623
+ }
34624
+ onlySkinnings(only) {
34625
+ const newSize = only.length;
34626
+ const ogIndices = this._indices;
34627
+ const ogWeights = this._weights;
34628
+ this.numskinnings = newSize;
34629
+ for (let i = 0; i < only.length; i++) {
34630
+ const j = only[i];
34631
+ const ogIndex = [
34632
+ ogIndices[j * 4 + 0],
34633
+ ogIndices[j * 4 + 1],
34634
+ ogIndices[j * 4 + 2],
34635
+ ogIndices[j * 4 + 3]
34636
+ ];
34637
+ const ogWeight = [
34638
+ ogWeights[j * 4 + 0],
34639
+ ogWeights[j * 4 + 1],
34640
+ ogWeights[j * 4 + 2],
34641
+ ogWeights[j * 4 + 3]
34642
+ ];
34643
+ this.setIndex(i, ogIndex);
34644
+ this.setWeight(i, ogWeight);
34653
34645
  }
34654
34646
  }
34655
- getSubsetIndex(vertIndex) {
34656
- for (let i = 0; i < this.subsets.length; i++) {
34657
- const subset = this.subsets[i];
34658
- if (subset.vertsBegin <= vertIndex && vertIndex < subset.vertsBegin + subset.vertsLength) {
34659
- return i;
34647
+ getBone(name) {
34648
+ for (const bone of this.bones) {
34649
+ if (bone.name === name) {
34650
+ return bone;
34660
34651
  }
34661
34652
  }
34662
- error(this);
34663
- throw new Error(`There is no subset for vert index ${vertIndex}`);
34664
34653
  }
34665
34654
  }
34666
34655
  class QuantizedMatrix {
@@ -34757,12 +34746,6 @@ function readBone(view) {
34757
34746
  bone.position = [view.readFloat32(), view.readFloat32(), view.readFloat32()];
34758
34747
  return bone;
34759
34748
  }
34760
- function readSkinning(view) {
34761
- const skinning = new FileMeshSkinning();
34762
- skinning.subsetIndices = [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()];
34763
- skinning.boneWeights = [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()];
34764
- return skinning;
34765
- }
34766
34749
  function readQuantizedMatrix(view) {
34767
34750
  const version = view.readUint16();
34768
34751
  const rows = view.readUint32();
@@ -34986,28 +34969,46 @@ class FileMesh {
34986
34969
  }
34987
34970
  readChunkSKINNING(view, version) {
34988
34971
  if (version !== 1) return;
34989
- this.skinning.numSkinnings = view.readUint32();
34990
- for (let i = 0; i < this.skinning.numSkinnings; i++) {
34991
- this.skinning.skinnings.push(readSkinning(view));
34972
+ this.skinning.numskinnings = view.readUint32();
34973
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
34974
+ this.skinning.readSkinning(view, i);
34992
34975
  }
34993
- this.skinning.numBones = view.readUint32();
34994
- for (let i = 0; i < this.skinning.numBones; i++) {
34976
+ const numBones = view.readUint32();
34977
+ for (let i = 0; i < numBones; i++) {
34995
34978
  this.skinning.bones.push(readBone(view));
34996
34979
  }
34997
- this.skinning.nameTableSize = view.readUint32();
34980
+ const nameTableSize = view.readUint32();
34981
+ const nameTable = [];
34982
+ const nameTableIndex = [];
34998
34983
  let lastString = "";
34999
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
34984
+ for (let i = 0; i < nameTableSize; i++) {
35000
34985
  if (view.readUint8() !== 0) {
35001
34986
  view.viewOffset--;
35002
34987
  lastString += view.readUtf8String(1);
35003
34988
  } else {
35004
- this.skinning.nameTable.push(lastString);
34989
+ nameTable.push(lastString);
34990
+ nameTableIndex.push(i - lastString.length);
35005
34991
  lastString = "";
35006
34992
  }
35007
34993
  }
35008
- this.skinning.numSubsets = view.readUint32();
35009
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35010
- this.skinning.subsets.push(readSubset(view));
34994
+ for (const bone of this.skinning.bones) {
34995
+ for (let i = 0; i < nameTable.length; i++) {
34996
+ if (nameTableIndex[i] === bone.boneNameIndex) {
34997
+ bone.name = nameTable[i];
34998
+ break;
34999
+ }
35000
+ }
35001
+ }
35002
+ const numSubsets = view.readUint32();
35003
+ for (let i = 0; i < numSubsets; i++) {
35004
+ const subset = readSubset(view);
35005
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35006
+ const indices = this.skinning.getIndex(i2);
35007
+ const newIndices = indices.map((v) => {
35008
+ return subset.boneIndices[v];
35009
+ });
35010
+ this.skinning.setIndex(i2, newIndices);
35011
+ }
35011
35012
  }
35012
35013
  }
35013
35014
  readChunkHSRAVIS(view, version) {
@@ -35201,9 +35202,9 @@ class FileMesh {
35201
35202
  this.coreMesh.numverts = view.readUint32();
35202
35203
  this.coreMesh.numfaces = view.readUint32();
35203
35204
  this.lods.numLodOffsets = view.readUint16();
35204
- this.skinning.numBones = view.readUint16();
35205
- this.skinning.nameTableSize = view.readUint32();
35206
- this.skinning.numSubsets = view.readUint16();
35205
+ const numBones = view.readUint16();
35206
+ const nameTableSize = view.readUint32();
35207
+ const numSubsets = view.readUint16();
35207
35208
  this.lods.numHighQualityLODs = view.readInt8();
35208
35209
  view.readInt8();
35209
35210
  if (version === "version 5.00\n") {
@@ -35213,9 +35214,10 @@ class FileMesh {
35213
35214
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35214
35215
  this.coreMesh.readVert(i, view);
35215
35216
  }
35216
- if (this.skinning.numBones > 0) {
35217
- for (let i = 0; i < this.coreMesh.numverts; i++) {
35218
- this.skinning.skinnings.push(readSkinning(view));
35217
+ if (numBones > 0) {
35218
+ this.skinning.numskinnings = this.coreMesh.numverts;
35219
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
35220
+ this.skinning.readSkinning(view, i);
35219
35221
  }
35220
35222
  }
35221
35223
  for (let i = 0; i < this.coreMesh.numfaces; i++) {
@@ -35224,21 +35226,39 @@ class FileMesh {
35224
35226
  for (let i = 0; i < this.lods.numLodOffsets; i++) {
35225
35227
  this.lods.lodOffsets.push(view.readUint32());
35226
35228
  }
35227
- for (let i = 0; i < this.skinning.numBones; i++) {
35229
+ for (let i = 0; i < numBones; i++) {
35228
35230
  this.skinning.bones.push(readBone(view));
35229
35231
  }
35232
+ const nameTable = [];
35233
+ const nameTableIndex = [];
35230
35234
  let lastString = "";
35231
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
35235
+ for (let i = 0; i < nameTableSize; i++) {
35232
35236
  if (view.readUint8() !== 0) {
35233
35237
  view.viewOffset--;
35234
35238
  lastString += view.readUtf8String(1);
35235
35239
  } else {
35236
- this.skinning.nameTable.push(lastString);
35240
+ nameTable.push(lastString);
35241
+ nameTableIndex.push(i - lastString.length);
35237
35242
  lastString = "";
35238
35243
  }
35239
35244
  }
35240
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35241
- this.skinning.subsets.push(readSubset(view));
35245
+ for (const bone of this.skinning.bones) {
35246
+ for (let i = 0; i < nameTable.length; i++) {
35247
+ if (nameTableIndex[i] === bone.boneNameIndex) {
35248
+ bone.name = nameTable[i];
35249
+ break;
35250
+ }
35251
+ }
35252
+ }
35253
+ for (let i = 0; i < numSubsets; i++) {
35254
+ const subset = readSubset(view);
35255
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35256
+ const indices = this.skinning.getIndex(i2);
35257
+ const newIndices = indices.map((v) => {
35258
+ return subset.boneIndices[v];
35259
+ });
35260
+ this.skinning.setIndex(i2, newIndices);
35261
+ }
35242
35262
  }
35243
35263
  if (version === "version 5.00\n" && this.facsDataFormat === 1 && this.sizeOfFacsData > 0) {
35244
35264
  this.facs = readFACS(view);
@@ -35259,6 +35279,9 @@ class FileMesh {
35259
35279
  warn(true, `Issue with parsed mesh: ${issue}`);
35260
35280
  }
35261
35281
  log(false, `Bytes left: ${view.view.byteLength - view.viewOffset}`);
35282
+ if (this.skinning.numskinnings > 0) {
35283
+ log(false, this.skinning);
35284
+ }
35262
35285
  }
35263
35286
  stripLODS() {
35264
35287
  let facesEnd = this.coreMesh.numfaces;
@@ -35277,28 +35300,16 @@ class FileMesh {
35277
35300
  }
35278
35301
  padSkinnings() {
35279
35302
  const vertsLength = this.coreMesh.numverts;
35280
- const skinningsLength = this.skinning.skinnings.length;
35303
+ const skinningsLength = this.skinning.numskinnings;
35281
35304
  const missingCount = vertsLength - skinningsLength;
35282
- for (let i = 0; i < missingCount; i++) {
35283
- this.skinning.skinnings.push(new FileMeshSkinning());
35284
- }
35285
- if (this.skinning.subsets.length === 0) {
35286
- const subset = new FileMeshSubset();
35287
- subset.boneIndices = new Array(26).fill(65535);
35288
- subset.boneIndices[0] = 0;
35289
- subset.vertsBegin = 0;
35290
- subset.vertsLength = this.coreMesh.numverts;
35291
- subset.facesBegin = 0;
35292
- subset.facesLength = this.coreMesh.numfaces;
35293
- subset.numBoneIndices = 1;
35294
- this.skinning.subsets.push(subset);
35295
- }
35296
- if (this.skinning.nameTable.length === 0) {
35297
- this.skinning.nameTable.push("Root");
35298
- this.skinning.nameTableSize = 4;
35305
+ this.skinning.increaseSkinnings(missingCount);
35306
+ for (let i = skinningsLength; i < vertsLength; i++) {
35307
+ this.skinning.setIndex(i, [0, 0, 0, 0]);
35308
+ this.skinning.setWeight(i, [0, 0, 0, 0]);
35299
35309
  }
35300
35310
  if (this.skinning.bones.length === 0) {
35301
35311
  const bone = new FileMeshBone();
35312
+ bone.name = "Root";
35302
35313
  bone.boneNameIndex = 0;
35303
35314
  bone.lodParentIndex = 65535;
35304
35315
  bone.parentIndex = 65535;
@@ -35307,11 +35318,21 @@ class FileMesh {
35307
35318
  this.skinning.bones.push(bone);
35308
35319
  }
35309
35320
  }
35321
+ setBoneSource(name) {
35322
+ for (const bone of this.skinning.bones) {
35323
+ bone.sourcePart = name;
35324
+ }
35325
+ }
35326
+ setBoneSourceSize() {
35327
+ for (const bone of this.skinning.bones) {
35328
+ bone.sourceSize = this.size;
35329
+ }
35330
+ }
35310
35331
  combine(other) {
35311
35332
  this.stripLODS();
35312
35333
  other = other.clone();
35313
35334
  other.stripLODS();
35314
- if (this.skinning.skinnings.length > 0 || other.skinning.skinnings.length > 0) {
35335
+ if (this.skinning.numskinnings > 0 || other.skinning.numskinnings > 0) {
35315
35336
  this.padSkinnings();
35316
35337
  other.padSkinnings();
35317
35338
  }
@@ -35335,8 +35356,7 @@ class FileMesh {
35335
35356
  }
35336
35357
  const boneIndexMap = /* @__PURE__ */ new Map();
35337
35358
  for (const bone of other.skinning.bones) {
35338
- const boneName = other.skinning.nameTable[other.skinning.bones.indexOf(bone)];
35339
- const foundBone = this.skinning.getBone(boneName);
35359
+ const foundBone = bone.name ? this.skinning.getBone(bone.name) : void 0;
35340
35360
  if (bone.parentIndex >= 65535) {
35341
35361
  boneIndexMap.set(other.skinning.bones.indexOf(bone), 0);
35342
35362
  continue;
@@ -35345,8 +35365,8 @@ class FileMesh {
35345
35365
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.indexOf(foundBone));
35346
35366
  } else {
35347
35367
  const parentBone = other.skinning.bones[bone.parentIndex];
35348
- const parentName = other.skinning.nameTable[other.skinning.bones.indexOf(parentBone)];
35349
- const foundParentBone = this.skinning.getBone(parentName);
35368
+ const parentName = parentBone.name;
35369
+ const foundParentBone = parentName ? this.skinning.getBone(parentName) : void 0;
35350
35370
  const boneCopy = bone.clone();
35351
35371
  boneCopy.parentIndex = 65535;
35352
35372
  boneCopy.lodParentIndex = 65535;
@@ -35355,31 +35375,20 @@ class FileMesh {
35355
35375
  boneCopy.parentIndex = foundParentIndex;
35356
35376
  boneCopy.lodParentIndex = foundParentIndex;
35357
35377
  }
35358
- this.skinning.nameTable.push(boneName);
35359
35378
  this.skinning.bones.push(boneCopy);
35360
35379
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.length - 1);
35361
35380
  }
35362
35381
  }
35363
- for (const subset of other.skinning.subsets) {
35364
- const newSubset = subset.clone();
35365
- newSubset.facesBegin += facesLength;
35366
- newSubset.vertsBegin += vertsLength;
35367
- for (let i = 0; i < newSubset.boneIndices.length; i++) {
35368
- const index = newSubset.boneIndices[i];
35369
- const newIndex = boneIndexMap.get(index);
35370
- if (index >= 65535) {
35371
- continue;
35372
- }
35373
- if (newIndex === void 0) {
35374
- throw new Error(`Bone ${index} is missing mapping`);
35375
- }
35376
- newSubset.boneIndices[i] = newIndex;
35377
- }
35378
- this.skinning.subsets.push(newSubset);
35379
- }
35380
- for (const skinning of other.skinning.skinnings) {
35381
- const newSkinning = skinning.clone();
35382
- this.skinning.skinnings.push(newSkinning);
35382
+ const ogSkinningsSize = this.skinning.numskinnings;
35383
+ this.skinning.increaseSkinnings(other.skinning.numskinnings);
35384
+ for (let i = 0; i < other.skinning.numskinnings; i++) {
35385
+ this.skinning.setIndex(
35386
+ ogSkinningsSize + i,
35387
+ other.skinning.getIndex(i).map((v) => {
35388
+ return boneIndexMap.get(v);
35389
+ })
35390
+ );
35391
+ this.skinning.setWeight(ogSkinningsSize + i, other.skinning.getWeight(i));
35383
35392
  }
35384
35393
  }
35385
35394
  removeDuplicateVertices(distance2 = 1e-4) {
@@ -35389,9 +35398,6 @@ class FileMesh {
35389
35398
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35390
35399
  const pos = this.coreMesh.getPos(i);
35391
35400
  const uv = this.coreMesh.getUV(i);
35392
- if (this.skinning.subsets.length > 0) {
35393
- vertToSubset[i] = this.skinning.getSubsetIndex(i);
35394
- }
35395
35401
  const hash = hashVec3(pos[0], pos[1], pos[2], distance2) + hashVec2(uv[0], uv[1]);
35396
35402
  const existing = posToIndex.get(hash);
35397
35403
  if (existing !== void 0) {
@@ -35419,10 +35425,7 @@ class FileMesh {
35419
35425
  newIndex.set(canonical, newVerts.length);
35420
35426
  newVerts.push(canonical);
35421
35427
  newSubsetIndices.push(vertToSubset[i]);
35422
- const skinning = this.skinning.skinnings[canonical];
35423
- if (skinning) {
35424
- newSkinnings.push(skinning);
35425
- }
35428
+ newSkinnings.push(canonical);
35426
35429
  }
35427
35430
  remap[i] = newIndex.get(canonical);
35428
35431
  }
@@ -35430,22 +35433,8 @@ class FileMesh {
35430
35433
  const remapFace = this.coreMesh.getFace(remap[i]);
35431
35434
  this.coreMesh.setFace(i, clonePrimitiveArray(remapFace));
35432
35435
  }
35433
- if (this.skinning.subsets.length > 0) {
35434
- for (const subset of this.skinning.subsets) {
35435
- subset.vertsBegin = Infinity;
35436
- subset.vertsLength = 0;
35437
- }
35438
- for (let i = 0; i < newVerts.length; i++) {
35439
- const subsetIndex = newSubsetIndices[i];
35440
- const subset = this.skinning.subsets[subsetIndex];
35441
- if (subset.vertsBegin > i) {
35442
- subset.vertsBegin = i;
35443
- }
35444
- subset.vertsLength += 1;
35445
- }
35446
- }
35447
35436
  this.coreMesh.onlyVerts(newVerts);
35448
- this.skinning.skinnings = newSkinnings;
35437
+ this.skinning.onlySkinnings(newSkinnings);
35449
35438
  return newVerts.length;
35450
35439
  }
35451
35440
  /*removeFace(index: number) {
@@ -35462,29 +35451,15 @@ class FileMesh {
35462
35451
  }
35463
35452
  basicSkin(boneNames) {
35464
35453
  this.skinning = new SKINNING();
35465
- this.skinning.skinnings = new Array(this.coreMesh.numverts);
35454
+ this.skinning.numskinnings = this.coreMesh.numverts;
35466
35455
  this.skinning.bones = new Array(boneNames.length);
35467
- this.skinning.nameTable = boneNames.slice();
35468
- this.skinning.numSkinnings = this.coreMesh.numverts;
35469
- this.skinning.numSubsets = 1;
35470
- this.skinning.numBones = boneNames.length;
35471
- const subset = new FileMeshSubset();
35472
- subset.boneIndices = new Array(26).fill(65535);
35473
- subset.boneIndices[0] = boneNames.length - 1;
35474
- subset.vertsBegin = 0;
35475
- subset.vertsLength = this.coreMesh.numverts;
35476
- subset.facesBegin = 0;
35477
- subset.facesLength = this.coreMesh.numverts;
35478
- subset.numBoneIndices = 1;
35479
- this.skinning.subsets = [subset];
35480
35456
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35481
- const skinning = new FileMeshSkinning();
35482
- skinning.boneWeights = [255, 0, 0, 0];
35483
- skinning.subsetIndices = [0, 0, 0, 0];
35484
- this.skinning.skinnings[i] = skinning;
35457
+ this.skinning.setIndex(i, [boneNames.length - 1, 0, 0, 0]);
35458
+ this.skinning.setWeight(i, [255, 0, 0, 0]);
35485
35459
  }
35486
35460
  for (let i = 0; i < boneNames.length; i++) {
35487
35461
  const bone = new FileMeshBone();
35462
+ bone.name = boneNames[i];
35488
35463
  bone.parentIndex = i - 1;
35489
35464
  if (bone.parentIndex < 0) {
35490
35465
  bone.parentIndex = 65535;
@@ -35496,15 +35471,6 @@ class FileMesh {
35496
35471
  }
35497
35472
  }
35498
35473
  getValidationIssue() {
35499
- if (this.skinning.skinnings.length > 0) {
35500
- let totalSubsetVerts = 0;
35501
- for (const subset of this.skinning.subsets) {
35502
- totalSubsetVerts += subset.vertsLength;
35503
- }
35504
- if (totalSubsetVerts !== this.skinning.skinnings.length) {
35505
- return "subsetLengthMismatch";
35506
- }
35507
- }
35508
35474
  return void 0;
35509
35475
  }
35510
35476
  }
@@ -35657,7 +35623,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
35657
35623
  "X-CSRF-TOKEN": xCsrfToken
35658
35624
  });
35659
35625
  try {
35660
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35626
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35661
35627
  method,
35662
35628
  credentials: FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE,
35663
35629
  headers: fetchHeaders,
@@ -35707,7 +35673,7 @@ async function RBLXGet(url, headers, includeCredentials = true, attempt = 0) {
35707
35673
  }
35708
35674
  const fetchHeaders = new Headers(newHeaders);
35709
35675
  try {
35710
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35676
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35711
35677
  credentials: includeCredentials ? FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE : void 0,
35712
35678
  headers: fetchHeaders,
35713
35679
  priority: FLAGS.ASSET_REQUEST_PRIORITY
@@ -35756,16 +35722,49 @@ function _updateCurrentlyLoadingAssets(type, label) {
35756
35722
  const newCurrentlyLoading = currentlyLoadingAssets.length > 0;
35757
35723
  API.Events.OnLoadingAssets.Fire(newCurrentlyLoading, type, label);
35758
35724
  }
35725
+ class Cache {
35726
+ map = /* @__PURE__ */ new Map();
35727
+ lastAccess = /* @__PURE__ */ new Map();
35728
+ maxEntries;
35729
+ constructor(maxEntries = 250) {
35730
+ this.maxEntries = maxEntries;
35731
+ }
35732
+ get(key) {
35733
+ if (this.map.has(key)) {
35734
+ this.lastAccess.set(key, Date.now());
35735
+ }
35736
+ return this.map.get(key);
35737
+ }
35738
+ set(key, value) {
35739
+ this.map.set(key, value);
35740
+ this.lastAccess.set(key, Date.now());
35741
+ if (this.map.size > this.maxEntries) {
35742
+ const toDelete = [...this.lastAccess.entries()].reduce((min, current) => {
35743
+ return current[1] < min[1] ? current : min;
35744
+ });
35745
+ this.delete(toDelete[0]);
35746
+ }
35747
+ return this;
35748
+ }
35749
+ has(key) {
35750
+ return this.map.has(key);
35751
+ }
35752
+ delete(key) {
35753
+ const toReturn = this.map.delete(key);
35754
+ this.lastAccess.delete(key);
35755
+ return toReturn;
35756
+ }
35757
+ }
35759
35758
  const CACHE = {
35760
- "AssetBuffer": /* @__PURE__ */ new Map(),
35761
- "RBX": /* @__PURE__ */ new Map(),
35762
- "Mesh": /* @__PURE__ */ new Map(),
35763
- "Image": /* @__PURE__ */ new Map(),
35764
- "Thumbnails": /* @__PURE__ */ new Map(),
35765
- "ItemOwned": /* @__PURE__ */ new Map(),
35766
- "IsLayered": /* @__PURE__ */ new Map(),
35767
- "AvatarInventoryItem": /* @__PURE__ */ new Map(),
35768
- "ItemDetails": /* @__PURE__ */ new Map(),
35759
+ "AssetBuffer": new Cache(250),
35760
+ "RBX": new Cache(100),
35761
+ "Mesh": new Cache(250),
35762
+ "Image": new Cache(100),
35763
+ "Thumbnails": new Cache(1e3),
35764
+ "ItemOwned": new Cache(1e3),
35765
+ "IsLayered": new Cache(1e3),
35766
+ "AvatarInventoryItem": new Cache(1e3),
35767
+ "ItemDetails": new Cache(1e4),
35769
35768
  "UserInfo": void 0
35770
35769
  };
35771
35770
  const ContentMap = /* @__PURE__ */ new Map();
@@ -36282,6 +36281,13 @@ const API = {
36282
36281
  return promise;
36283
36282
  }
36284
36283
  },
36284
+ /**
36285
+ * Remember to call .Destroy() on the Instance returned by RBX.generateTree() to avoid memory leaks
36286
+ * @param url
36287
+ * @param headers
36288
+ * @param contentRepresentationPriorityList
36289
+ * @returns
36290
+ */
36285
36291
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36286
36292
  GetRBX: async function(url, headers, contentRepresentationPriorityList) {
36287
36293
  const fetchStr = url;
@@ -36359,6 +36365,7 @@ const API = {
36359
36365
  }
36360
36366
  }
36361
36367
  CACHE.IsLayered.set(id, hasWrapLayer);
36368
+ dataModel.Destroy();
36362
36369
  return hasWrapLayer;
36363
36370
  } else {
36364
36371
  warn(true, "Failed to get accessory");
@@ -36463,6 +36470,18 @@ const API = {
36463
36470
  }
36464
36471
  //https://apis.roblox.com/marketplace-widgets/v1/pills
36465
36472
  },
36473
+ "Develop": {
36474
+ GetLatestVersions: async function(auth, assetIds) {
36475
+ const response = await RBLXPost("https://develop.roblox.com/v1/assets/latest-versions", auth, {
36476
+ assetIds,
36477
+ versionStatus: "Any"
36478
+ });
36479
+ if (response.status !== 200) {
36480
+ return response;
36481
+ }
36482
+ return await response.json();
36483
+ }
36484
+ },
36466
36485
  "Inventory": {
36467
36486
  GetInventory: async function(userId, assetType, cursor) {
36468
36487
  let requestUrl = `https://inventory.roblox.com/v2/users/${userId}/inventory/${assetType}?sortOrder=Desc&limit=100`;
@@ -41204,6 +41223,210 @@ class RenderDesc extends DisposableDesc {
41204
41223
  return this.constructor;
41205
41224
  }
41206
41225
  }
41226
+ function getPartAssemblyScore(part) {
41227
+ let score = 0;
41228
+ if (part.PropOrDefault("Name", "Part") === "HumanoidRootPart") {
41229
+ score += 1e6;
41230
+ }
41231
+ if (part.PropOrDefault("Anchored", false)) {
41232
+ score += 1e5;
41233
+ }
41234
+ if (part.PropOrDefault("Massless", false)) {
41235
+ score += 1e4;
41236
+ }
41237
+ const size = part.PropOrDefault("size", new Vector32(0, 0, 0));
41238
+ score += size.X * size.Y * size.Z;
41239
+ return score;
41240
+ }
41241
+ function getPartsInAssembly_Generate(part) {
41242
+ const inAssembly = [];
41243
+ let toCheck = [part];
41244
+ while (toCheck.length > 0) {
41245
+ const newToCheck = [];
41246
+ for (const part2 of toCheck) {
41247
+ const connected = part2.w.GetConnectedParts();
41248
+ for (const connect of connected) {
41249
+ if (!inAssembly.includes(connect)) {
41250
+ inAssembly.push(connect);
41251
+ newToCheck.push(connect);
41252
+ }
41253
+ }
41254
+ }
41255
+ toCheck = newToCheck;
41256
+ }
41257
+ return inAssembly;
41258
+ }
41259
+ function getRootAssemblyPart_Generate(part) {
41260
+ const parts = getPartsInAssembly_Generate(part);
41261
+ let highestScore = -1;
41262
+ let highestPart = part;
41263
+ for (const part2 of parts) {
41264
+ const score = getPartAssemblyScore(part2);
41265
+ if (score > highestScore) {
41266
+ highestScore = score;
41267
+ highestPart = part2;
41268
+ }
41269
+ }
41270
+ return highestPart;
41271
+ }
41272
+ class AssemblyNode {
41273
+ depth;
41274
+ nodes = [];
41275
+ part;
41276
+ children = [];
41277
+ connectors = [];
41278
+ parent;
41279
+ assembly;
41280
+ traversedRestCFrame = new CFrame();
41281
+ traversedTransformCFrame = new CFrame();
41282
+ constructor(assembly, parent, depth, part, already = []) {
41283
+ this.assembly = assembly;
41284
+ this.parent = parent;
41285
+ this.depth = depth;
41286
+ this.part = part;
41287
+ if (part.IsA("BasePart")) {
41288
+ const w = part.w;
41289
+ w.data.assemblyNode = this;
41290
+ }
41291
+ const connected = part.w.GetConnectedParts();
41292
+ for (const connect of connected) {
41293
+ if (!already.includes(connect)) {
41294
+ this.children.push(connect);
41295
+ }
41296
+ }
41297
+ const jointConnectors = part.w.GetConnectors();
41298
+ this.connectors = jointConnectors;
41299
+ }
41300
+ getNodeChildren() {
41301
+ return this.nodes;
41302
+ }
41303
+ getNodeDescendants() {
41304
+ let descendants = [...this.getNodeChildren()];
41305
+ for (const child of this.getNodeChildren()) {
41306
+ descendants = descendants.concat(child.getNodeDescendants());
41307
+ }
41308
+ return descendants;
41309
+ }
41310
+ getParentConnector() {
41311
+ if (this.parent instanceof Assembly) return;
41312
+ for (const connector of this.connectors) {
41313
+ if (this.parent.connectors.includes(connector)) {
41314
+ return connector;
41315
+ }
41316
+ }
41317
+ }
41318
+ getConnectorOffset(includeTransform) {
41319
+ const parentConnector = this.getParentConnector();
41320
+ if (!parentConnector) return new CFrame();
41321
+ if (parentConnector.Prop("Part0") === this.part) {
41322
+ return parentConnector.Prop("C0");
41323
+ } else if (parentConnector.Prop("Part1") === this.part) {
41324
+ const transform = includeTransform ? parentConnector.PropOrDefault("Transform", new CFrame()) : new CFrame();
41325
+ return parentConnector.Prop("C1").multiply(transform).inverse();
41326
+ }
41327
+ return new CFrame();
41328
+ }
41329
+ _traverseTree(transform, rest) {
41330
+ const parentConnector = this.getParentConnector();
41331
+ if (parentConnector) {
41332
+ const w = parentConnector.w;
41333
+ transform = transform.multiply(w.getAssemblyOffset(true));
41334
+ rest = rest.multiply(w.getAssemblyOffset(false));
41335
+ }
41336
+ this.traversedTransformCFrame = transform.clone();
41337
+ this.traversedRestCFrame = rest.clone();
41338
+ this.part.setProperty("CFrame", this.assembly.traverseCFrame(this, true, true));
41339
+ for (const node of this.nodes) {
41340
+ node._traverseTree(transform, rest);
41341
+ }
41342
+ }
41343
+ /**
41344
+ * Should only be called when destroying entire assembly by calling Assembly.destroy()
41345
+ */
41346
+ destroy() {
41347
+ if (this.part.IsA("BasePart")) {
41348
+ const w = this.part.w;
41349
+ w.data.assemblyNode = void 0;
41350
+ }
41351
+ }
41352
+ }
41353
+ let lastAssemblyId = 0;
41354
+ class Assembly {
41355
+ id = lastAssemblyId++;
41356
+ rootNode;
41357
+ allNodes;
41358
+ allConnectors;
41359
+ constructor(rootPart) {
41360
+ const checked = [rootPart];
41361
+ let depth = 0;
41362
+ this.rootNode = new AssemblyNode(this, this, 0, rootPart, checked);
41363
+ let toCheckNodes = [this.rootNode];
41364
+ while (toCheckNodes.length > 0) {
41365
+ depth += 1;
41366
+ const newToCheckNodes = [];
41367
+ for (const toCheck of toCheckNodes) {
41368
+ for (const child of toCheck.children) {
41369
+ const childNode = new AssemblyNode(this, toCheck, depth, child, checked);
41370
+ checked.push(child);
41371
+ newToCheckNodes.push(childNode);
41372
+ toCheck.nodes.push(childNode);
41373
+ }
41374
+ }
41375
+ toCheckNodes = newToCheckNodes;
41376
+ }
41377
+ this.traverseTree();
41378
+ }
41379
+ getNodeDescendants() {
41380
+ if (!this.allNodes) {
41381
+ this.allNodes = [this.rootNode, ...this.rootNode.getNodeDescendants()];
41382
+ }
41383
+ return this.allNodes;
41384
+ }
41385
+ getPartDescendants() {
41386
+ return this.getNodeDescendants().map((v) => {
41387
+ return v.part;
41388
+ });
41389
+ }
41390
+ getAllConnectors() {
41391
+ if (!this.allConnectors) {
41392
+ this.allConnectors = [];
41393
+ for (const node of this.getNodeDescendants()) {
41394
+ this.allConnectors.push(...node.connectors);
41395
+ }
41396
+ }
41397
+ return this.allConnectors;
41398
+ }
41399
+ getNode(name) {
41400
+ for (const node of this.getNodeDescendants()) {
41401
+ if (node.part.Prop("Name") === name) {
41402
+ return node;
41403
+ }
41404
+ }
41405
+ }
41406
+ getPart(name) {
41407
+ return this.getNode(name)?.part;
41408
+ }
41409
+ traverseTree() {
41410
+ this.rootNode._traverseTree(new CFrame(), new CFrame());
41411
+ }
41412
+ traverseCFrame(node, includeTransform, applyRoot = false) {
41413
+ const traversedCF = includeTransform ? node.traversedTransformCFrame : node.traversedRestCFrame;
41414
+ let finalCF = traversedCF.clone();
41415
+ if (applyRoot) {
41416
+ finalCF = this.rootNode.part.Prop("CFrame").multiply(finalCF);
41417
+ }
41418
+ return finalCF;
41419
+ }
41420
+ traverseInstance(node) {
41421
+ return traverseRigInstance(node.part);
41422
+ }
41423
+ destroy() {
41424
+ const descendants = this.getNodeDescendants();
41425
+ for (const descendant of descendants) {
41426
+ descendant.destroy();
41427
+ }
41428
+ }
41429
+ }
41207
41430
  class AccessoryWrapper extends InstanceWrapper {
41208
41431
  static className = "Accessory";
41209
41432
  static requiredProperties = [
@@ -41267,18 +41490,31 @@ const __vite_glob_0_0$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
41267
41490
  __proto__: null,
41268
41491
  AccessoryWrapper
41269
41492
  }, Symbol.toStringTag, { value: "Module" }));
41270
- class AnimationConstraintWrapper extends InstanceWrapper {
41271
- static className = "AnimationConstraint";
41493
+ class ConstraintWrapper extends InstanceWrapper {
41494
+ static className = "Constraint";
41272
41495
  static requiredProperties = [
41273
41496
  "Name",
41274
41497
  "Attachment0",
41275
- "Attachment1",
41276
- "Transform"
41498
+ "Attachment1"
41277
41499
  ];
41278
41500
  setup() {
41279
41501
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
41280
41502
  if (!this.instance.HasProperty("Attachment0")) this.instance.addProperty(new Property("Attachment0", DataType.Referent), void 0);
41281
41503
  if (!this.instance.HasProperty("Attachment1")) this.instance.addProperty(new Property("Attachment1", DataType.Referent), void 0);
41504
+ }
41505
+ }
41506
+ const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41507
+ __proto__: null,
41508
+ ConstraintWrapper
41509
+ }, Symbol.toStringTag, { value: "Module" }));
41510
+ class AnimationConstraintWrapper extends ConstraintWrapper {
41511
+ static className = "AnimationConstraint";
41512
+ static requiredProperties = [
41513
+ ...super.requiredProperties,
41514
+ "Transform"
41515
+ ];
41516
+ setup() {
41517
+ super.setup();
41282
41518
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
41283
41519
  }
41284
41520
  }
@@ -42141,7 +42377,7 @@ function calculateMotor6Doffset(motor, includeTransform = false) {
42141
42377
  const finalCF = C0.multiply(offset1);
42142
42378
  return finalCF;
42143
42379
  }
42144
- function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42380
+ function traverseRigCFrameNoAssembly(instance, includeTransform = false, applyRoot = false) {
42145
42381
  const motors = [];
42146
42382
  let lastInstance = instance;
42147
42383
  let lastMotor6D = void 0;
@@ -42221,6 +42457,35 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
42221
42457
  }
42222
42458
  return finalCF;
42223
42459
  }
42460
+ function traverseRigCFrameAssembly(instance, includeTransform = false, applyRoot = false) {
42461
+ const motors = [];
42462
+ let assemblyNode = instance.w.GetAssemblyNode();
42463
+ while (!(assemblyNode.parent instanceof Assembly)) {
42464
+ for (const connector of assemblyNode.connectors) {
42465
+ if (assemblyNode.parent.connectors.includes(connector)) {
42466
+ motors.push(connector);
42467
+ break;
42468
+ }
42469
+ }
42470
+ assemblyNode = assemblyNode.parent;
42471
+ }
42472
+ motors.reverse();
42473
+ let finalCF = new CFrame();
42474
+ for (const motor of motors) {
42475
+ finalCF = finalCF.multiply(calculateMotor6Doffset(motor, includeTransform));
42476
+ }
42477
+ if (applyRoot) {
42478
+ finalCF = assemblyNode.assembly.rootNode.part.Prop("CFrame").multiply(finalCF);
42479
+ }
42480
+ return finalCF;
42481
+ }
42482
+ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42483
+ if (FLAGS.USE_ASSEMBLY) {
42484
+ return traverseRigCFrameAssembly(instance, includeTransform, applyRoot);
42485
+ } else {
42486
+ return traverseRigCFrameNoAssembly(instance, includeTransform, applyRoot);
42487
+ }
42488
+ }
42224
42489
  function traverseRigInstanceOld(instance) {
42225
42490
  const children = [];
42226
42491
  let lastMotor6D = instance.FindFirstChildOfClass("Motor6D");
@@ -42238,7 +42503,7 @@ function traverseRigInstanceOld(instance) {
42238
42503
  children.reverse();
42239
42504
  return children;
42240
42505
  }
42241
- function traverseRigInstance(instance) {
42506
+ function traverseRigInstanceNoAssembly(instance) {
42242
42507
  const children = [];
42243
42508
  let lastMotor6D = void 0;
42244
42509
  if (instance.className === "Motor6D" || instance.className === "Weld") {
@@ -42304,6 +42569,23 @@ function traverseRigInstance(instance) {
42304
42569
  children.reverse();
42305
42570
  return children;
42306
42571
  }
42572
+ function traverseRigInstanceAssembly(instance) {
42573
+ const children = [];
42574
+ let assemblyNode = instance.w.GetAssemblyNode();
42575
+ while (!(assemblyNode.parent instanceof Assembly)) {
42576
+ children.push(assemblyNode.part);
42577
+ assemblyNode = assemblyNode.parent;
42578
+ }
42579
+ children.reverse();
42580
+ return children;
42581
+ }
42582
+ function traverseRigInstance(instance) {
42583
+ if (FLAGS.USE_ASSEMBLY) {
42584
+ return traverseRigInstanceAssembly(instance);
42585
+ } else {
42586
+ return traverseRigInstanceNoAssembly(instance);
42587
+ }
42588
+ }
42307
42589
  const modelLayers = /* @__PURE__ */ new Map();
42308
42590
  function arrIsSameVector3(arr0, arr1) {
42309
42591
  if (arr0.length !== arr1.length) {
@@ -42506,6 +42788,12 @@ class ModelLayersDesc {
42506
42788
  }
42507
42789
  return true;
42508
42790
  }
42791
+ getTargetName(i) {
42792
+ if (!this.targetParents) throw new Error("this.targetParents is missing");
42793
+ const targetParents = this.targetParents[i];
42794
+ const targetName = targetParents[targetParents.length - 1];
42795
+ return targetName;
42796
+ }
42509
42797
  fromModel(model) {
42510
42798
  this.targetMeshes = [];
42511
42799
  this.targetCages = [];
@@ -42607,12 +42895,14 @@ class ModelLayersDesc {
42607
42895
  }
42608
42896
  for (let i = 0; i < this.targetMeshes.length; i++) {
42609
42897
  const targetMesh = meshMap.get(this.targetMeshes[i]);
42610
- if (targetMesh.skinning.skinnings.length < 1) {
42898
+ if (targetMesh.skinning.numskinnings < 1) {
42611
42899
  targetMesh.basicSkin(this.targetParents[i]);
42612
42900
  }
42613
42901
  const targetCage = meshMap.get(this.targetCages[i]);
42614
42902
  targetCage.removeDuplicateVertices();
42615
42903
  inheritSkeleton(targetCage, targetMesh);
42904
+ targetCage.setBoneSource(this.getTargetName(i));
42905
+ targetCage.setBoneSourceSize();
42616
42906
  }
42617
42907
  const distDeformer = this.targetDeformers[0];
42618
42908
  const dist_mesh = distDeformer ? meshMap.get(distDeformer.targetCage).clone() : meshMap.get(this.targetCages[0]).clone();
@@ -43047,32 +43337,25 @@ function fileMeshToTHREEGeometry(mesh, canIncludeSkinning = true, forceVertexCol
43047
43337
  const toUseIndices = mesh.coreMesh.getIndices().subarray(facesStart * 3, facesEnd * 3);
43048
43338
  geometry.setIndex(new BufferAttribute(toUseIndices, 1));
43049
43339
  const meshSkinning = mesh.skinning;
43050
- if (meshSkinning && meshSkinning.subsets.length > 0 && canIncludeSkinning) {
43051
- const skinIndices = new Uint16Array(meshSkinning.skinnings.length * 4);
43052
- const skinWeights = new Float32Array(meshSkinning.skinnings.length * 4);
43053
- const hasRootBone = meshSkinning.nameTable.includes("Root") || meshSkinning.nameTable.includes("root");
43054
- for (const subset of meshSkinning.subsets) {
43055
- for (let i = subset.vertsBegin; i < subset.vertsBegin + subset.vertsLength; i++) {
43056
- const skinning = meshSkinning.skinnings[i];
43057
- skinWeights[i * 4 + 0] = skinning.boneWeights[0] / 255;
43058
- skinWeights[i * 4 + 1] = skinning.boneWeights[1] / 255;
43059
- skinWeights[i * 4 + 2] = skinning.boneWeights[2] / 255;
43060
- skinWeights[i * 4 + 3] = skinning.boneWeights[3] / 255;
43061
- 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) {
43062
- error(mesh);
43063
- error(subset);
43064
- error(skinning);
43065
- throw new Error("mesh is invalid");
43066
- }
43067
- const index0 = subset.boneIndices[skinning.subsetIndices[0]];
43068
- const index1 = subset.boneIndices[skinning.subsetIndices[1]];
43069
- const index2 = subset.boneIndices[skinning.subsetIndices[2]];
43070
- const index3 = subset.boneIndices[skinning.subsetIndices[3]];
43071
- skinIndices[i * 4 + 0] = !hasRootBone && index0 > 0 ? index0 + 1 : index0;
43072
- skinIndices[i * 4 + 1] = !hasRootBone && index1 > 0 ? index1 + 1 : index1;
43073
- skinIndices[i * 4 + 2] = !hasRootBone && index2 > 0 ? index2 + 1 : index2;
43074
- skinIndices[i * 4 + 3] = !hasRootBone && index3 > 0 ? index3 + 1 : index3;
43075
- }
43340
+ if (meshSkinning && meshSkinning.numskinnings > 0 && canIncludeSkinning) {
43341
+ const skinIndices = meshSkinning.indices.slice();
43342
+ const skinWeights = meshSkinning.weights.slice();
43343
+ const hasRootBone = meshSkinning.getBone("Root") !== void 0 || meshSkinning.getBone("root") !== void 0;
43344
+ for (let i = 0; i < meshSkinning.numskinnings; i++) {
43345
+ const boneWeights = meshSkinning.getWeight(i);
43346
+ const boneIndices = meshSkinning.getIndex(i);
43347
+ skinWeights[i * 4 + 0] = boneWeights[0] / 255;
43348
+ skinWeights[i * 4 + 1] = boneWeights[1] / 255;
43349
+ skinWeights[i * 4 + 2] = boneWeights[2] / 255;
43350
+ skinWeights[i * 4 + 3] = boneWeights[3] / 255;
43351
+ const index0 = boneIndices[0];
43352
+ const index1 = boneIndices[1];
43353
+ const index2 = boneIndices[2];
43354
+ const index3 = boneIndices[3];
43355
+ skinIndices[i * 4 + 0] = !hasRootBone && index0 > 0 ? index0 + 1 : index0;
43356
+ skinIndices[i * 4 + 1] = !hasRootBone && index1 > 0 ? index1 + 1 : index1;
43357
+ skinIndices[i * 4 + 2] = !hasRootBone && index2 > 0 ? index2 + 1 : index2;
43358
+ skinIndices[i * 4 + 3] = !hasRootBone && index3 > 0 ? index3 + 1 : index3;
43076
43359
  }
43077
43360
  geometry.setAttribute("skinIndex", new Uint16BufferAttribute(skinIndices, 4));
43078
43361
  geometry.setAttribute("skinWeight", new Float32BufferAttribute(skinWeights, 4));
@@ -43113,6 +43396,7 @@ class MeshDesc {
43113
43396
  instance;
43114
43397
  fileMesh;
43115
43398
  wasAutoSkinned = false;
43399
+ wasDeformed = false;
43116
43400
  dispose() {
43117
43401
  this.instance = void 0;
43118
43402
  }
@@ -43291,14 +43575,13 @@ class MeshDesc {
43291
43575
  }
43292
43576
  if (FLAGS.SHOW_CAGE) {
43293
43577
  the_ref_mesh = dist_mesh;
43294
- the_ref_mesh.skinning.skinnings = [];
43578
+ the_ref_mesh.skinning.numskinnings = 0;
43295
43579
  the_ref_mesh.skinning.bones = [];
43296
- the_ref_mesh.skinning.subsets = [];
43297
43580
  }
43298
43581
  const layeredClothingCacheId = `${this.mesh}-${this.layerDesc.reference}`;
43299
43582
  switch (FLAGS.LAYERED_CLOTHING_ALGORITHM) {
43300
43583
  case "rbf": {
43301
- const shouldAutoSkin = this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledOverride || this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledPreserve && mesh.skinning.skinnings.length < 1 || mesh.skinning.skinnings.length <= 0;
43584
+ const shouldAutoSkin = this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledOverride || this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledPreserve && mesh.skinning.numskinnings < 1 || mesh.skinning.numskinnings <= 0;
43302
43585
  if (FLAGS.AUTO_SKIN_EVERYTHING || shouldAutoSkin) {
43303
43586
  this.wasAutoSkinned = true;
43304
43587
  const transferTo = ref_mesh.clone();
@@ -43310,6 +43593,7 @@ class MeshDesc {
43310
43593
  noDeformation = true;
43311
43594
  }
43312
43595
  rbfDeformer.affectBones = FLAGS.USE_LOCAL_SKELETONDESC;
43596
+ this.wasDeformed = true;
43313
43597
  await rbfDeformer.solveAsync();
43314
43598
  rbfDeformer.deformMesh();
43315
43599
  break;
@@ -43442,7 +43726,7 @@ class MeshDesc {
43442
43726
  let mesh = void 0;
43443
43727
  mesh = await this.getMesh();
43444
43728
  if (mesh instanceof Response) return mesh;
43445
- if (!mesh.facs && this.headMesh && mesh.skinning.skinnings.length > 0) {
43729
+ if (!mesh.facs && this.headMesh && mesh.skinning.numskinnings > 0) {
43446
43730
  const headMesh = await API.Asset.GetMesh(this.headMesh, void 0, true);
43447
43731
  if (headMesh instanceof Response) {
43448
43732
  warn(true, "Failed to get headMesh for compileMesh", headMesh);
@@ -43554,26 +43838,6 @@ class MeshDesc {
43554
43838
  const meshIdStr = child.Property("MeshId");
43555
43839
  this.mesh = meshIdStr;
43556
43840
  this.scaleIsRelative = true;
43557
- if (!FLAGS.AVATAR_JOINT_UPGRADE) {
43558
- if (child.FindFirstChildOfClass("Bone")) {
43559
- this.canHaveSkinning = false;
43560
- } else {
43561
- if (child.Prop("Name").includes("Arm")) {
43562
- const rig = child.parent;
43563
- if (rig) {
43564
- const humanoid = rig.FindFirstChildOfClass("Humanoid");
43565
- if (humanoid) {
43566
- const side = child.Prop("Name").startsWith("Right") ? "Right" : "Left";
43567
- const handName = side + "Hand";
43568
- const hand = rig.FindFirstChild(handName);
43569
- if (hand && hand.FindFirstChildOfClass("Bone")) {
43570
- this.canHaveSkinning = false;
43571
- }
43572
- }
43573
- }
43574
- }
43575
- }
43576
- }
43577
43841
  const surfaceAppearance = child.FindLastChildOfClass("SurfaceAppearance");
43578
43842
  if (surfaceAppearance) {
43579
43843
  const color = surfaceAppearance.HasProperty("Color") ? surfaceAppearance.Prop("Color") : new Color3(1, 1, 1);
@@ -44933,6 +45197,84 @@ class MaterialDesc {
44933
45197
  }
44934
45198
  }
44935
45199
  }
45200
+ class BasePartWrapperData {
45201
+ assemblyNode;
45202
+ }
45203
+ class BasePartWrapper extends InstanceWrapper {
45204
+ static className = "BasePart";
45205
+ static requiredProperties = [
45206
+ "Name",
45207
+ "CFrame",
45208
+ "size",
45209
+ "Transparency",
45210
+ "_data"
45211
+ ];
45212
+ setup() {
45213
+ if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
45214
+ if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
45215
+ if (!this.instance.HasProperty("size")) this.instance.addProperty(new Property("size", DataType.Vector3), new Vector32());
45216
+ if (!this.instance.HasProperty("Transparency")) this.instance.addProperty(new Property("Transparency", DataType.Float32), 0);
45217
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new BasePartWrapperData());
45218
+ }
45219
+ get data() {
45220
+ return this.instance.Prop("_data");
45221
+ }
45222
+ created() {
45223
+ const destroyAssembly = () => {
45224
+ if (this.data.assemblyNode) {
45225
+ this.data.assemblyNode.assembly.destroy();
45226
+ }
45227
+ };
45228
+ this.instance.referencedByChanged.Connect(destroyAssembly);
45229
+ this.instance.AncestryChanged.Connect(destroyAssembly);
45230
+ this.instance.ChildRemoved.Connect(destroyAssembly);
45231
+ this.instance.Destroying.Connect(destroyAssembly);
45232
+ }
45233
+ preRender() {
45234
+ if (FLAGS.USE_ASSEMBLY) {
45235
+ const assemblyNode = this.GetAssemblyNode();
45236
+ if (assemblyNode.depth === 0) {
45237
+ assemblyNode.assembly.traverseTree();
45238
+ }
45239
+ }
45240
+ }
45241
+ GetAssemblyNode() {
45242
+ if (this.data.assemblyNode) return this.data.assemblyNode;
45243
+ const rootPart = getRootAssemblyPart_Generate(this.instance);
45244
+ new Assembly(rootPart);
45245
+ return this.data.assemblyNode;
45246
+ }
45247
+ GetAssembly() {
45248
+ return this.GetAssemblyNode().assembly;
45249
+ }
45250
+ GetConnectors() {
45251
+ const connectors = [];
45252
+ const references = this.instance.getReferencedBy();
45253
+ for (const reference of references) {
45254
+ if (reference.IsA("JointInstance")) {
45255
+ connectors.push(reference);
45256
+ }
45257
+ }
45258
+ return connectors;
45259
+ }
45260
+ GetConnectedParts() {
45261
+ const connected = [];
45262
+ const references = this.instance.getReferencedBy();
45263
+ for (const reference of references) {
45264
+ if (reference.IsA("JointInstance")) {
45265
+ const part0 = reference.Prop("Part0");
45266
+ const part1 = reference.Prop("Part1");
45267
+ if (part0 && part0 !== this.instance && part0.IsA("BasePart")) connected.push(part0);
45268
+ if (part1 && part1 !== this.instance && part1.IsA("BasePart")) connected.push(part1);
45269
+ }
45270
+ }
45271
+ return connected;
45272
+ }
45273
+ }
45274
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45275
+ __proto__: null,
45276
+ BasePartWrapper
45277
+ }, Symbol.toStringTag, { value: "Module" }));
44936
45278
  class FaceControlsWrapper extends InstanceWrapper {
44937
45279
  static className = "FaceControls";
44938
45280
  static requiredProperties = ["Name", ...FaceControlNames];
@@ -44945,27 +45287,12 @@ class FaceControlsWrapper extends InstanceWrapper {
44945
45287
  }
44946
45288
  }
44947
45289
  }
44948
- const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45290
+ const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44949
45291
  __proto__: null,
44950
45292
  FaceControlsWrapper
44951
45293
  }, Symbol.toStringTag, { value: "Module" }));
44952
- const BaseR15Bones = ["Root", "HumanoidRootNode", "LowerTorso", "UpperTorso", "RightUpperArm", "RightLowerArm", "RightHand", "LeftUpperArm", "LeftLowerArm", "LeftHand", "Head", "DynamicHead"];
44953
- function getJointForInstances$1(parent, child, includeTransform) {
44954
- const childMotor = child.FindFirstChildOfClass("Motor6D");
44955
- const parentMotor = parent.FindFirstChildOfClass("Motor6D");
44956
- let transform = new CFrame();
44957
- if (childMotor) {
44958
- if (includeTransform) {
44959
- transform = childMotor.Prop("Transform");
44960
- }
44961
- let initalCF = new CFrame();
44962
- if (parentMotor) {
44963
- initalCF = parentMotor.Prop("C1").inverse();
44964
- }
44965
- const jointCF = initalCF.multiply(childMotor.Prop("C0")).multiply(transform.inverse());
44966
- return jointCF;
44967
- }
44968
- return new CFrame();
45294
+ function diffCFrame(parent, child) {
45295
+ return parent.inverse().multiply(child);
44969
45296
  }
44970
45297
  function boneIsChildOf(bone, parentName) {
44971
45298
  let nextParent = bone.parent;
@@ -44977,73 +45304,16 @@ function boneIsChildOf(bone, parentName) {
44977
45304
  }
44978
45305
  return false;
44979
45306
  }
44980
- function getBoneBaseR15Parent(bone) {
44981
- let currentParent = bone.parent;
44982
- if (!currentParent) return;
44983
- while (currentParent && !BaseR15Bones.includes(currentParent.name)) {
44984
- currentParent = currentParent.parent;
44985
- }
44986
- if (!currentParent) {
44987
- return bone.parent;
44988
- } else {
44989
- return currentParent;
44990
- }
44991
- }
44992
- function boneIsBaseR15(bone) {
44993
- return BaseR15Bones.includes(bone.name);
44994
- }
44995
- function getMotorsInRig(rigChildren) {
44996
- const motors = [];
44997
- for (const child of rigChildren) {
44998
- for (const motor of child.GetChildren()) {
44999
- if (motor.className === "Motor6D") {
45000
- motors.push(motor);
45001
- }
45002
- }
45003
- }
45004
- return motors;
45005
- }
45006
- function getBoneDependencies(rig) {
45007
- const names = /* @__PURE__ */ new Map();
45008
- const hrp = rig.FindFirstChild("HumanoidRootPart");
45009
- let currentSearch = hrp ? [hrp] : [];
45010
- let currentSearchOrigin = hrp ? ["Root"] : [];
45011
- const children = rig.GetChildren();
45012
- const motors = getMotorsInRig(children);
45013
- const searchedParts = [];
45014
- while (currentSearch.length > 0 && currentSearch[0]) {
45015
- const newCurrentSearch = [];
45016
- const newCurrentSearchOrigin = [];
45017
- for (let i = 0; i < currentSearch.length; i++) {
45018
- const toSearch = currentSearch[i];
45019
- searchedParts.push(toSearch);
45020
- const selfName = toSearch === hrp ? "HumanoidRootNode" : toSearch.Prop("Name");
45021
- names.set(selfName, currentSearchOrigin[i]);
45022
- for (const motor of motors) {
45023
- if (motor.Prop("Part0") === toSearch && !searchedParts.includes(motor.parent)) {
45024
- newCurrentSearch.push(motor.parent);
45025
- newCurrentSearchOrigin.push(selfName);
45026
- }
45027
- }
45028
- }
45029
- currentSearch = newCurrentSearch;
45030
- currentSearchOrigin = newCurrentSearchOrigin;
45031
- }
45032
- if (names.get("Head")) {
45033
- names.set("DynamicHead", "Head");
45034
- }
45035
- return names;
45036
- }
45037
- let SkeletonDesc$1 = class SkeletonDesc {
45307
+ class SkeletonDesc {
45038
45308
  renderableDesc;
45039
45309
  meshDesc;
45040
45310
  skeleton;
45041
45311
  rootBone;
45042
45312
  bones;
45043
45313
  originalBoneCFrames = [];
45044
- originalHeadCFrame = new CFrame();
45045
- originalDynamicHeadCFrame = new CFrame();
45314
+ boneSourceParts = [];
45046
45315
  skeletonHelper;
45316
+ frameCount = 0;
45047
45317
  constructor(renderableDesc, meshDesc, scene) {
45048
45318
  this.renderableDesc = renderableDesc;
45049
45319
  this.meshDesc = meshDesc;
@@ -45055,9 +45325,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45055
45325
  const boneArr = [];
45056
45326
  for (let i = 0; i < skinning.bones.length; i++) {
45057
45327
  const threeBone = new Bone();
45058
- threeBone.name = skinning.nameTable[i];
45059
- if (threeBone.name === "HumanoidRootPart") {
45060
- threeBone.name = "HumanoidRootNode";
45328
+ threeBone.name = skinning.bones[i].name || "";
45329
+ if (threeBone.name === "HumanoidRootNode") {
45330
+ threeBone.name = "HumanoidRootPart";
45061
45331
  }
45062
45332
  if (threeBone.name === "root") {
45063
45333
  threeBone.name = "Root";
@@ -45066,6 +45336,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45066
45336
  }
45067
45337
  this.bones = boneArr;
45068
45338
  log(false, skinning);
45339
+ log(false, this);
45069
45340
  let rootBone = void 0;
45070
45341
  for (let i = 0; i < skinning.bones.length; i++) {
45071
45342
  const bone = skinning.bones[i];
@@ -45078,18 +45349,15 @@ let SkeletonDesc$1 = class SkeletonDesc {
45078
45349
  const worldBoneCF = new CFrame(...bone.position);
45079
45350
  worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45080
45351
  const boneCF = worldParentBoneCF.inverse().multiply(worldBoneCF);
45081
- this.originalBoneCFrames.push(boneCF);
45082
- if (threeBone.name === "Head") {
45083
- this.originalHeadCFrame = boneCF;
45084
- } else if (threeBone.name === "DynamicHead") {
45085
- this.originalDynamicHeadCFrame = boneCF;
45086
- }
45352
+ this.boneSourceParts.push(bone.sourcePart);
45353
+ this.originalBoneCFrames.push(worldBoneCF);
45087
45354
  setTHREEObjectCF(threeBone, boneCF);
45088
45355
  parentThreeBone.add(threeBone);
45089
45356
  } else {
45090
45357
  rootBone = threeBone;
45091
45358
  const boneCF = new CFrame(...bone.position);
45092
45359
  boneCF.fromRotationMatrix(...bone.rotationMatrix);
45360
+ this.boneSourceParts.push(bone.sourcePart);
45093
45361
  this.originalBoneCFrames.push(boneCF);
45094
45362
  setTHREEObjectCF(threeBone, boneCF);
45095
45363
  }
@@ -45103,6 +45371,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45103
45371
  trueRootBone.name = "Root";
45104
45372
  trueRootBone.position.set(0, 0, 0);
45105
45373
  trueRootBone.rotation.set(0, 0, 0, "YXZ");
45374
+ this.boneSourceParts.unshift(void 0);
45106
45375
  this.originalBoneCFrames.unshift(new CFrame());
45107
45376
  this.bones.unshift(trueRootBone);
45108
45377
  trueRootBone.add(rootBone);
@@ -45110,23 +45379,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45110
45379
  }
45111
45380
  this.rootBone = rootBone;
45112
45381
  }
45113
- const rig = this.getRig();
45114
- if (rig) {
45115
- const boneDependencies = getBoneDependencies(rig);
45116
- for (const bone of [...this.bones]) {
45117
- let lastBone = bone.name;
45118
- while (lastBone) {
45119
- const newLastBone = boneDependencies.get(lastBone);
45120
- if (newLastBone && !this.getBoneWithName(newLastBone)) {
45121
- this.insertBefore(newLastBone, lastBone);
45122
- }
45123
- lastBone = newLastBone;
45124
- }
45125
- }
45126
- }
45127
45382
  this.skeleton = new Skeleton(boneArr);
45128
45383
  this.setAsRest();
45129
- if (FLAGS.SHOW_SKELETON_HELPER) {
45384
+ if (FLAGS.SHOW_SKELETON_HELPER && (FLAGS.SKELETON_HELPER_INSTANCE_NAME === void 0 || FLAGS.SKELETON_HELPER_INSTANCE_NAME === meshDesc.instance?.name)) {
45130
45385
  const skeletonHelper = new SkeletonHelper(this.rootBone);
45131
45386
  scene.add(skeletonHelper);
45132
45387
  this.skeletonHelper = skeletonHelper;
@@ -45139,39 +45394,6 @@ let SkeletonDesc$1 = class SkeletonDesc {
45139
45394
  this.skeleton.boneInverses[boneIndex].copy(bone.matrixWorld).invert();
45140
45395
  }
45141
45396
  }
45142
- traverseOriginal(name) {
45143
- const cframes = [];
45144
- let lastBone = this.getBoneWithName(name);
45145
- while (lastBone) {
45146
- const index = this.bones.indexOf(lastBone);
45147
- const ogCFrame = this.originalBoneCFrames[index];
45148
- cframes.push(ogCFrame);
45149
- lastBone = lastBone.parent ? this.getBoneWithName(lastBone.parent.name) : void 0;
45150
- }
45151
- cframes.reverse();
45152
- let finalCF = new CFrame();
45153
- for (const cf of cframes) {
45154
- finalCF = finalCF.multiply(cf);
45155
- }
45156
- return finalCF;
45157
- }
45158
- insertBefore(toInsert, before) {
45159
- const bone = new Bone();
45160
- bone.name = toInsert;
45161
- bone.position.set(0, 0, 0);
45162
- bone.rotation.set(0, 0, 0, "YXZ");
45163
- for (let i = 0; i < this.bones.length; i++) {
45164
- if (this.bones[i].name === before) {
45165
- const beforeBone = this.bones[i];
45166
- const beforeParent = beforeBone.parent;
45167
- this.originalBoneCFrames.push(new CFrame());
45168
- this.bones.push(bone);
45169
- bone.add(beforeBone);
45170
- beforeParent?.add(bone);
45171
- break;
45172
- }
45173
- }
45174
- }
45175
45397
  getBoneWithName(name) {
45176
45398
  for (const bone of this.bones) {
45177
45399
  if (bone.name === name) {
@@ -45190,377 +45412,160 @@ let SkeletonDesc$1 = class SkeletonDesc {
45190
45412
  return rig;
45191
45413
  }
45192
45414
  }
45193
- getPartEquivalent(selfInstance, name) {
45194
- if (!selfInstance.parent) return;
45195
- let partEquivalent = selfInstance.parent.FindFirstChild(name);
45196
- if (partEquivalent === void 0 && selfInstance.parent.parent) {
45197
- partEquivalent = selfInstance.parent.parent.FindFirstChild(name);
45198
- }
45199
- return partEquivalent;
45415
+ getScale(node) {
45416
+ if (this.meshDesc.wasAutoSkinned) return new Vector32(1, 1, 1);
45417
+ const partSize = node.part.Prop("Size");
45418
+ const meshSize = node.part.PropOrDefault("InitialSize", new Vector32(...this.meshDesc.fileMesh.size));
45419
+ const scale = partSize.divide(meshSize);
45420
+ return scale;
45200
45421
  }
45201
- getRootCFrame(instance, includeTransform) {
45202
- if (includeTransform) {
45203
- return instance.Prop("CFrame");
45204
- } else {
45205
- let bodyPart = void 0;
45206
- if (instance.parent && instance.parent.FindFirstChildOfClass("Humanoid")) {
45207
- bodyPart = instance;
45208
- } else if (instance.parent && instance.parent.parent && instance.parent.className === "Accessory") {
45209
- bodyPart = GetAttachedPart(instance.parent, instance.parent.parent);
45210
- }
45211
- const hrp = this.getPartEquivalent(instance, "HumanoidRootPart");
45212
- if (hrp && bodyPart) {
45213
- return hrp.Prop("CFrame").multiply(traverseRigCFrame(bodyPart));
45214
- }
45215
- }
45216
- return new CFrame();
45422
+ getOriginalWorldCFrameNoChange(bone) {
45423
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45424
+ return ogCF;
45217
45425
  }
45218
- updateBoneMatrix(selfInstance, includeTransform = false) {
45219
- if (!selfInstance.parent) return;
45220
- if (!this.meshDesc.fileMesh) return;
45221
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45222
- const rootBoneCFog = this.getRootCFrame(selfInstance, includeTransform);
45223
- const humanoidRootPartEquivalent = this.getPartEquivalent(selfInstance, "HumanoidRootPart");
45224
- for (let i = 0; i < this.bones.length; i++) {
45225
- const bone = this.bones[i];
45226
- const partEquivalent = this.getPartEquivalent(selfInstance, bone.name);
45227
- const boneParent = boneIsBaseR15(bone) ? getBoneBaseR15Parent(bone) : bone.parent;
45228
- const parentPartEquivalent = boneParent ? boneParent.name !== "HumanoidRootNode" ? this.getPartEquivalent(selfInstance, boneParent.name) : humanoidRootPartEquivalent : void 0;
45229
- let rootBoneCF = new CFrame();
45230
- if (bone.name === "Root") {
45231
- rootBoneCF = rootBoneCFog;
45232
- } else if (bone.parent?.name === "Root") {
45233
- rootBoneCF = rootBoneCFog.inverse();
45234
- }
45235
- if (partEquivalent && parentPartEquivalent) {
45236
- setTHREEObjectCF(bone, rootBoneCF.multiply(getJointForInstances$1(parentPartEquivalent, partEquivalent, includeTransform)));
45237
- } else if (partEquivalent) {
45238
- if (includeTransform) {
45239
- setTHREEObjectCF(bone, rootBoneCF.multiply(partEquivalent.Prop("CFrame")));
45240
- } else {
45241
- let hrpCF = new CFrame();
45242
- const hrp = humanoidRootPartEquivalent;
45243
- if (hrp) {
45244
- hrpCF = hrp.Prop("CFrame");
45245
- }
45246
- setTHREEObjectCF(bone, rootBoneCF.multiply(hrpCF.multiply(traverseRigCFrame(partEquivalent))));
45247
- }
45248
- } else if (bone.name === "Root") {
45249
- setTHREEObjectCF(bone, rootBoneCF.multiply(new CFrame()));
45250
- } else if (bone.name === "HumanoidRootNode") {
45251
- let rootCF = new CFrame();
45252
- const rootPart = humanoidRootPartEquivalent;
45253
- if (rootPart) {
45254
- rootCF = rootPart.Prop("CFrame");
45255
- }
45256
- setTHREEObjectCF(bone, rootBoneCF.multiply(rootCF));
45257
- } else if (bone.name === "DynamicHead" && isHead) {
45258
- const head = this.getPartEquivalent(selfInstance, "Head");
45259
- if (head) {
45260
- let targetCF = this.traverseOriginal("DynamicHead");
45261
- if (this.meshDesc.wasAutoSkinned) {
45262
- targetCF = this.originalBoneCFrames[i];
45263
- }
45264
- const headSize = head.Prop("Size");
45265
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45266
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45267
- if (this.meshDesc.wasAutoSkinned) {
45268
- scale = [1, 1, 1];
45269
- }
45270
- const scaledCF = targetCF.clone();
45271
- scaledCF.Position = multiply(scaledCF.Position, scale);
45272
- const neck = head.FindFirstChildOfClass("Motor6D");
45273
- let neckCF = new CFrame();
45274
- if (neck) {
45275
- neckCF = neck.PropOrDefault("C1", new CFrame());
45276
- }
45277
- if (this.meshDesc.wasAutoSkinned) {
45278
- neckCF = new CFrame();
45279
- }
45280
- const totalCF = neckCF.inverse().multiply(scaledCF);
45281
- setTHREEObjectCF(bone, totalCF);
45282
- }
45283
- } else if (!isHead || boneIsChildOf(bone, "DynamicHead")) {
45284
- const ogCF = this.originalBoneCFrames[i];
45285
- const head = this.getPartEquivalent(selfInstance, "Head");
45286
- if (head) {
45287
- const headSize = head.Prop("Size");
45288
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45289
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45290
- if (this.meshDesc.wasAutoSkinned) {
45291
- scale = [1, 1, 1];
45292
- }
45293
- const scaledCF = ogCF.clone();
45294
- scaledCF.Position = multiply(scaledCF.Position, scale);
45295
- const headOffset = this.originalHeadCFrame.clone();
45296
- headOffset.Position = [0, 0, 0];
45297
- if (bone.name !== "DynamicHead") {
45298
- headOffset.Orientation = [0, 0, 0];
45299
- }
45300
- const finalCF = headOffset.multiply(scaledCF);
45301
- setTHREEObjectCF(bone, finalCF);
45302
- }
45426
+ getOriginalWorldCFrame(bone, node) {
45427
+ if (this.meshDesc.wasAutoSkinned) {
45428
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45429
+ const nodeWorldCF = node.assembly.traverseCFrame(node, false, false);
45430
+ return nodeWorldCF.inverse().multiply(ogCF);
45431
+ } else {
45432
+ const scale = this.getScale(node);
45433
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45434
+ ogCF.Position = multiply(ogCF.Position, scale.toVec3());
45435
+ return ogCF;
45436
+ }
45437
+ }
45438
+ getSourcePart(bone) {
45439
+ return this.boneSourceParts[this.bones.indexOf(bone)];
45440
+ }
45441
+ getSourceNode(selfNode, bone, assembly) {
45442
+ const sourceName = this.getSourcePart(bone);
45443
+ const potentialSourceNode = sourceName ? assembly.getNode(sourceName) : selfNode;
45444
+ const sourceNode = potentialSourceNode ? potentialSourceNode : selfNode;
45445
+ return sourceNode;
45446
+ }
45447
+ getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform) {
45448
+ const node = assembly.getNode(bone.name);
45449
+ const selfNode = selfInstance.w.GetAssemblyNode();
45450
+ const sourceNode = this.getSourceNode(selfNode, bone, assembly);
45451
+ if (bone.name === "Root") {
45452
+ return assembly.traverseCFrame(selfNode, includeTransform, true);
45453
+ } else if (node) {
45454
+ if (this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned && bone.name === "Head") {
45455
+ const ogCF = assembly.traverseCFrame(node, includeTransform, true);
45456
+ const connectorOffset = node.getConnectorOffset(includeTransform).inverse();
45457
+ connectorOffset.Orientation = [0, 0, 0];
45458
+ return ogCF.multiply(connectorOffset);
45459
+ } else {
45460
+ return assembly.traverseCFrame(node, includeTransform, true);
45303
45461
  }
45304
- }
45305
- this.updateMatrixWorld();
45306
- if (!includeTransform) {
45307
- this.setAsRest();
45308
- this.updateMatrixWorld();
45309
- }
45310
- }
45311
- updateMatrixWorld() {
45312
- for (const bone of this.skeleton.bones) {
45313
- bone.updateMatrixWorld(true);
45462
+ } else {
45463
+ const result = assembly.traverseCFrame(sourceNode, includeTransform, true).multiply(this.getOriginalWorldCFrame(bone, sourceNode));
45464
+ return result;
45314
45465
  }
45315
45466
  }
45316
- update(instance) {
45317
- if (!FLAGS.UPDATE_SKELETON || !instance.parent || !this.meshDesc.fileMesh) return;
45318
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45319
- this.updateBoneMatrix(instance);
45320
- if (FLAGS.ANIMATE_SKELETON) {
45321
- this.updateBoneMatrix(instance, true);
45322
- for (const bone of this.skeleton.bones) {
45323
- const isFACS = this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(bone.name);
45324
- if (isFACS) {
45325
- const facsMesh = this.meshDesc.fileMesh;
45326
- const facs = this.meshDesc.fileMesh?.facs;
45327
- const head = this.getPartEquivalent(instance, "Head");
45328
- if (head && facsMesh && facs && facs.quantizedTransforms) {
45329
- const headSize = head.Prop("Size");
45330
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head);
45331
- let headScale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45332
- if (this.meshDesc.wasAutoSkinned) {
45333
- headScale = [1, 1, 1];
45334
- }
45335
- let faceControls = head.FindFirstChildOfClass("FaceControls");
45336
- if (!faceControls) {
45337
- faceControls = new Instance("FaceControls");
45338
- faceControls.setParent(head);
45339
- }
45340
- new FaceControlsWrapper(faceControls);
45341
- for (let j = 0; j < facs.faceBoneNames.length; j++) {
45342
- const boneName = facs.faceBoneNames[j];
45343
- if (boneName === bone.name) {
45344
- let jointCF = new CFrame();
45345
- const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)];
45346
- jointCF = ogCF.clone();
45347
- const head2 = this.getPartEquivalent(instance, "Head");
45348
- if (head2) {
45349
- const headSize2 = head2.Prop("Size");
45350
- const ogHeadSize2 = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head2);
45351
- let scale = divide(headSize2.toVec3(), ogHeadSize2.toVec3());
45352
- if (this.meshDesc.wasAutoSkinned) {
45353
- scale = [1, 1, 1];
45354
- }
45355
- jointCF.Position = multiply(jointCF.Position, scale);
45356
- }
45357
- let totalPosition = new Vector32();
45358
- let totalRotation = new Vector32();
45359
- for (let i = 0; i < facs.faceControlNames.length; i++) {
45360
- const faceControlName = facs.faceControlNames[i];
45361
- const col = i;
45362
- const row = j;
45363
- const cols = facs.faceControlNames.length;
45364
- const index = row * cols + col;
45365
- const posX = facs.quantizedTransforms.px.matrix[index];
45366
- const posY = facs.quantizedTransforms.py.matrix[index];
45367
- const posZ = facs.quantizedTransforms.pz.matrix[index];
45368
- const rotX = facs.quantizedTransforms.rx.matrix[index];
45369
- const rotY = facs.quantizedTransforms.ry.matrix[index];
45370
- const rotZ = facs.quantizedTransforms.rz.matrix[index];
45371
- const pos = new Vector32(posX, posY, posZ);
45372
- const rot = new Vector32(rotX, rotY, rotZ);
45373
- let weight = 0;
45374
- if (faceControlName.includes(" ")) {
45375
- weight = 1;
45376
- for (const faceControlSubname of faceControlName.split(" ")) {
45377
- const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45378
- weight *= faceControls.Prop(propertyName);
45379
- }
45380
- } else {
45381
- const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45382
- if (propertyName === void 0) {
45383
- log(false, faceControlName);
45384
- }
45385
- weight = faceControls.Prop(propertyName);
45386
- }
45387
- totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45388
- totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45389
- }
45390
- const resultCF = new CFrame();
45391
- const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "XYZ");
45392
- euler.reorder("YXZ");
45393
- resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45394
- resultCF.Position = multiply(totalPosition.toVec3(), headScale);
45395
- setTHREEObjectCF(bone, jointCF.multiply(resultCF));
45396
- break;
45467
+ isFACS(boneName) {
45468
+ return this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(boneName);
45469
+ }
45470
+ addFACS(restCF, bone, assembly) {
45471
+ const isFACS = this.isFACS(bone.name);
45472
+ if (!isFACS) return restCF;
45473
+ const facsMesh = this.meshDesc.fileMesh;
45474
+ const facs = this.meshDesc.fileMesh?.facs;
45475
+ const headNode = assembly.getNode("Head");
45476
+ if (headNode && facsMesh && facs && facs.quantizedTransforms) {
45477
+ const head = headNode.part;
45478
+ let faceControls = head.FindFirstChildOfClass("FaceControls");
45479
+ if (!faceControls) {
45480
+ faceControls = new Instance("FaceControls");
45481
+ faceControls.setParent(head);
45482
+ }
45483
+ new FaceControlsWrapper(faceControls);
45484
+ for (let j = 0; j < facs.faceBoneNames.length; j++) {
45485
+ const boneName = facs.faceBoneNames[j];
45486
+ if (boneName === bone.name) {
45487
+ let totalPosition = new Vector32();
45488
+ let totalRotation = new Vector32();
45489
+ for (let i = 0; i < facs.faceControlNames.length; i++) {
45490
+ const faceControlName = facs.faceControlNames[i];
45491
+ const col = i;
45492
+ const row = j;
45493
+ const cols = facs.faceControlNames.length;
45494
+ const index = row * cols + col;
45495
+ const posX = facs.quantizedTransforms.px.matrix[index];
45496
+ const posY = facs.quantizedTransforms.py.matrix[index];
45497
+ const posZ = facs.quantizedTransforms.pz.matrix[index];
45498
+ const rotX = facs.quantizedTransforms.rx.matrix[index];
45499
+ const rotY = facs.quantizedTransforms.ry.matrix[index];
45500
+ const rotZ = facs.quantizedTransforms.rz.matrix[index];
45501
+ const pos = new Vector32(posX, posY, posZ);
45502
+ const rot = new Vector32(rotX, rotY, rotZ);
45503
+ let weight = 0;
45504
+ if (faceControlName.includes(" ")) {
45505
+ weight = 1;
45506
+ for (const faceControlSubname of faceControlName.split(" ")) {
45507
+ const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45508
+ weight *= faceControls.Prop(propertyName);
45509
+ }
45510
+ } else {
45511
+ const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45512
+ if (propertyName === void 0) {
45513
+ log(false, faceControlName);
45397
45514
  }
45515
+ weight = faceControls.Prop(propertyName);
45398
45516
  }
45517
+ totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45518
+ totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45399
45519
  }
45520
+ const resultCF = new CFrame();
45521
+ const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "XYZ");
45522
+ euler.reorder("YXZ");
45523
+ resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45524
+ resultCF.Position = multiply(totalPosition.toVec3(), this.getScale(headNode).toVec3());
45525
+ return restCF.multiply(resultCF);
45400
45526
  }
45401
45527
  }
45402
45528
  }
45403
- this.updateMatrixWorld();
45404
- }
45405
- dispose(scene) {
45406
- if (this.skeletonHelper) {
45407
- scene.remove(this.skeletonHelper);
45408
- this.skeletonHelper.dispose();
45409
- this.skeletonHelper = void 0;
45410
- }
45411
- if (this.rootBone.parent) {
45412
- this.rootBone.parent.remove(this.rootBone);
45413
- }
45414
- for (let i = 0; i < this.skeleton.bones.length; i++) {
45415
- const bone = this.skeleton.bones[i];
45416
- if (bone.parent) {
45417
- bone.removeFromParent();
45418
- }
45419
- }
45420
- }
45421
- static descNeedsSkeleton(meshDesc) {
45422
- return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.subsets.length > 0 && meshDesc.fileMesh.skinning.skinnings.length > 0;
45423
- }
45424
- };
45425
- function setBoneToCFrame(bone, cf) {
45426
- bone.position.set(...cf.Position);
45427
- bone.rotation.order = "YXZ";
45428
- bone.rotation.x = rad(cf.Orientation[0]);
45429
- bone.rotation.y = rad(cf.Orientation[1]);
45430
- bone.rotation.z = rad(cf.Orientation[2]);
45431
- }
45432
- function getJointForInstances(child, includeTransform) {
45433
- const childMotor = child.FindFirstChildOfClass("Motor6D");
45434
- let transform = new CFrame();
45435
- if (childMotor) {
45436
- if (includeTransform) {
45437
- transform = childMotor.Prop("Transform");
45438
- return transform.inverse();
45439
- }
45440
- }
45441
- return new CFrame();
45442
- }
45443
- class SkeletonDesc2 {
45444
- renderableDesc;
45445
- meshDesc;
45446
- skeleton;
45447
- rootBone;
45448
- bones;
45449
- originalBoneCFrames = [];
45450
- originalHeadCFrame = new CFrame();
45451
- originalDynamicHeadCFrame = new CFrame();
45452
- skeletonHelper;
45453
- constructor(renderableDesc, meshDesc, scene) {
45454
- this.renderableDesc = renderableDesc;
45455
- this.meshDesc = meshDesc;
45456
- const mesh = this.meshDesc.fileMesh;
45457
- if (!mesh) {
45458
- throw new Error("MeshDesc is not compiled");
45459
- }
45460
- const skinning = mesh.skinning;
45461
- const boneArr = [];
45462
- for (let i = 0; i < skinning.bones.length; i++) {
45463
- const threeBone = new Bone();
45464
- threeBone.name = skinning.nameTable[i];
45465
- boneArr.push(threeBone);
45466
- }
45467
- this.bones = boneArr;
45468
- let rootBone = void 0;
45469
- for (let i = 0; i < skinning.bones.length; i++) {
45470
- const bone = skinning.bones[i];
45471
- const threeBone = boneArr[i];
45472
- if (bone.parentIndex < skinning.bones.length) {
45473
- const parentBone = skinning.bones[bone.parentIndex];
45474
- const parentThreeBone = boneArr[bone.parentIndex];
45475
- const worldParentBoneCF = new CFrame(...parentBone.position);
45476
- worldParentBoneCF.fromRotationMatrix(...parentBone.rotationMatrix);
45477
- const worldBoneCF = new CFrame(...bone.position);
45478
- worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45479
- const boneCF = worldParentBoneCF.inverse().multiply(worldBoneCF);
45480
- this.originalBoneCFrames.push(boneCF);
45481
- if (threeBone.name === "Head") {
45482
- this.originalHeadCFrame = boneCF;
45483
- } else if (threeBone.name === "DynamicHead") {
45484
- this.originalDynamicHeadCFrame = boneCF;
45485
- }
45486
- setBoneToCFrame(threeBone, boneCF);
45487
- parentThreeBone.add(threeBone);
45488
- } else {
45489
- rootBone = threeBone;
45490
- const worldBoneCF = new CFrame(...bone.position);
45491
- worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45492
- setBoneToCFrame(threeBone, worldBoneCF);
45493
- this.originalBoneCFrames.push(worldBoneCF);
45494
- }
45495
- }
45496
- if (!rootBone) {
45497
- throw new Error("FileMesh has no root bone");
45498
- } else {
45499
- if (rootBone && rootBone.name !== "Root") {
45500
- const trueRootBone = new Bone();
45501
- trueRootBone.name = "Root";
45502
- trueRootBone.position.set(0, 0, 0);
45503
- trueRootBone.rotation.set(0, 0, 0, "YXZ");
45504
- this.originalBoneCFrames.unshift(new CFrame());
45505
- this.bones.unshift(trueRootBone);
45506
- trueRootBone.add(rootBone);
45507
- rootBone = trueRootBone;
45508
- }
45509
- this.rootBone = rootBone;
45510
- }
45511
- this.skeleton = new Skeleton(boneArr);
45512
- this.setAsRest();
45513
- if (FLAGS.SHOW_SKELETON_HELPER) {
45514
- const skeletonHelper = new SkeletonHelper(this.rootBone);
45515
- scene.add(skeletonHelper);
45516
- this.skeletonHelper = skeletonHelper;
45517
- }
45518
- }
45519
- setAsRest() {
45520
- for (const bone of this.skeleton.bones) {
45521
- const boneIndex = this.skeleton.bones.indexOf(bone);
45522
- this.skeleton.boneInverses[boneIndex].copy(bone.matrixWorld).invert();
45523
- }
45524
- }
45525
- getPartEquivalent(selfInstance, name) {
45526
- if (!selfInstance.parent) return;
45527
- let partEquivalent = selfInstance.parent.FindFirstChild(name);
45528
- if (partEquivalent === void 0 && selfInstance.parent.parent) {
45529
- partEquivalent = selfInstance.parent.parent.FindFirstChild(name);
45530
- }
45531
- return partEquivalent;
45532
- }
45533
- getRootCFrame(instance, includeTransform) {
45534
- if (includeTransform) {
45535
- return instance.Prop("CFrame");
45536
- } else {
45537
- let bodyPart = void 0;
45538
- if (instance.parent && instance.parent.FindFirstChildOfClass("Humanoid")) {
45539
- bodyPart = instance;
45540
- } else if (instance.parent && instance.parent.parent && instance.parent.className === "Accessory") {
45541
- bodyPart = GetAttachedPart(instance.parent, instance.parent.parent);
45542
- }
45543
- const hrp = this.getPartEquivalent(instance, "HumanoidRootPart");
45544
- if (hrp && bodyPart) {
45545
- return hrp.Prop("CFrame").multiply(traverseRigCFrame(bodyPart));
45546
- }
45547
- }
45548
- return new CFrame();
45529
+ return restCF;
45549
45530
  }
45550
45531
  updateBoneMatrix(selfInstance, includeTransform = false) {
45551
45532
  if (!selfInstance.parent) return;
45552
45533
  if (!this.meshDesc.fileMesh) return;
45553
- const ogMeshSize = new Vector32(...this.meshDesc.fileMesh.size);
45554
- const scale = divide((this.meshDesc.instance?.Prop("Size")).toVec3(), ogMeshSize.toVec3());
45534
+ const w = selfInstance.w;
45535
+ if (!(w instanceof BasePartWrapper)) return;
45536
+ const assembly = w.GetAssembly();
45537
+ const boneWorldCFrameArr = new Array(this.bones.length);
45538
+ for (let i = 0; i < this.bones.length; i++) {
45539
+ const bone = this.bones[i];
45540
+ const boneWorldCFrame = this.getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform);
45541
+ boneWorldCFrameArr[i] = boneWorldCFrame;
45542
+ }
45555
45543
  for (let i = 0; i < this.bones.length; i++) {
45556
45544
  const bone = this.bones[i];
45557
- const partEquivalent = this.getPartEquivalent(selfInstance, bone.name);
45558
- const ogBoneCF = this.originalBoneCFrames[i].clone();
45559
- ogBoneCF.Position = multiply(ogBoneCF.Position, scale);
45560
- if (partEquivalent && includeTransform) {
45561
- setBoneToCFrame(bone, ogBoneCF.multiply(getJointForInstances(partEquivalent, includeTransform)));
45545
+ const boneWorldCFrame = boneWorldCFrameArr[i];
45546
+ let parentBone = bone.parent;
45547
+ if (!(parentBone instanceof Bone)) parentBone = null;
45548
+ if (bone && parentBone) {
45549
+ if ((boneIsChildOf(bone, "DynamicHead") || bone.name === "DynamicHead") && this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned) {
45550
+ const parentBoneWorldCFrame = this.getOriginalWorldCFrameNoChange(parentBone);
45551
+ const boneWorldCFrameNoChange = this.getOriginalWorldCFrameNoChange(bone);
45552
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrameNoChange);
45553
+ let scale = new Vector32(1, 1, 1);
45554
+ const headNode = assembly.getNode("Head");
45555
+ if (headNode) {
45556
+ scale = this.getScale(headNode);
45557
+ }
45558
+ diffCF.Position = multiply(diffCF.Position, scale.toVec3());
45559
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45560
+ setTHREEObjectCF(bone, diffCF);
45561
+ } else {
45562
+ const parentBoneWorldCFrame = boneWorldCFrameArr[this.bones.indexOf(parentBone)];
45563
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrame);
45564
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45565
+ setTHREEObjectCF(bone, diffCF);
45566
+ }
45562
45567
  } else {
45563
- setBoneToCFrame(bone, ogBoneCF);
45568
+ setTHREEObjectCF(bone, boneWorldCFrame);
45564
45569
  }
45565
45570
  }
45566
45571
  this.updateMatrixWorld();
@@ -45576,85 +45581,12 @@ class SkeletonDesc2 {
45576
45581
  }
45577
45582
  update(instance) {
45578
45583
  if (!FLAGS.UPDATE_SKELETON || !instance.parent || !this.meshDesc.fileMesh) return;
45579
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45580
45584
  this.updateBoneMatrix(instance);
45581
45585
  if (FLAGS.ANIMATE_SKELETON) {
45582
45586
  this.updateBoneMatrix(instance, true);
45583
- for (const bone of this.skeleton.bones) {
45584
- const isFACS = this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(bone.name);
45585
- if (isFACS) {
45586
- const facsMesh = this.meshDesc.fileMesh;
45587
- const facs = this.meshDesc.fileMesh?.facs;
45588
- const head = this.getPartEquivalent(instance, "Head");
45589
- if (head && facsMesh && facs && facs.quantizedTransforms) {
45590
- let faceControls = head.FindFirstChildOfClass("FaceControls");
45591
- if (!faceControls) {
45592
- faceControls = new Instance("FaceControls");
45593
- faceControls.setParent(head);
45594
- }
45595
- new FaceControlsWrapper(faceControls);
45596
- for (let j = 0; j < facs.faceBoneNames.length; j++) {
45597
- const boneName = facs.faceBoneNames[j];
45598
- if (boneName === bone.name) {
45599
- let jointCF = new CFrame();
45600
- const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)];
45601
- jointCF = ogCF.clone();
45602
- const head2 = this.getPartEquivalent(instance, "Head");
45603
- if (head2) {
45604
- const headSize = head2.Prop("Size");
45605
- const ogHeadSize = isHead ? new Vector32(...this.meshDesc.fileMesh.size) : getOriginalSize(head2);
45606
- let scale = divide(headSize.toVec3(), ogHeadSize.toVec3());
45607
- if (this.meshDesc.wasAutoSkinned) {
45608
- scale = [1, 1, 1];
45609
- }
45610
- jointCF.Position = multiply(jointCF.Position, scale);
45611
- }
45612
- let totalPosition = new Vector32();
45613
- let totalRotation = new Vector32();
45614
- for (let i = 0; i < facs.faceControlNames.length; i++) {
45615
- const faceControlName = facs.faceControlNames[i];
45616
- const col = i;
45617
- const row = j;
45618
- const cols = facs.faceControlNames.length;
45619
- const index = row * cols + col;
45620
- const posX = facs.quantizedTransforms.px.matrix[index];
45621
- const posY = facs.quantizedTransforms.py.matrix[index];
45622
- const posZ = facs.quantizedTransforms.pz.matrix[index];
45623
- const rotX = facs.quantizedTransforms.rx.matrix[index];
45624
- const rotY = facs.quantizedTransforms.ry.matrix[index];
45625
- const rotZ = facs.quantizedTransforms.rz.matrix[index];
45626
- const pos = new Vector32(posX, posY, posZ);
45627
- const rot = new Vector32(rotX, rotY, rotZ);
45628
- let weight = 0;
45629
- if (faceControlName.includes(" ")) {
45630
- weight = 1;
45631
- for (const faceControlSubname of faceControlName.split(" ")) {
45632
- const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45633
- weight *= faceControls.Prop(propertyName);
45634
- }
45635
- } else {
45636
- const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45637
- if (propertyName === void 0) {
45638
- log(false, faceControlName);
45639
- }
45640
- weight = faceControls.Prop(propertyName);
45641
- }
45642
- totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45643
- totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45644
- }
45645
- const resultCF = new CFrame();
45646
- const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "YXZ");
45647
- resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45648
- resultCF.Position = totalPosition.toVec3();
45649
- setBoneToCFrame(bone, jointCF.multiply(resultCF));
45650
- break;
45651
- }
45652
- }
45653
- }
45654
- }
45655
- }
45656
45587
  }
45657
45588
  this.updateMatrixWorld();
45589
+ this.frameCount += 1;
45658
45590
  }
45659
45591
  dispose(scene) {
45660
45592
  if (this.skeletonHelper) {
@@ -45673,7 +45605,7 @@ class SkeletonDesc2 {
45673
45605
  }
45674
45606
  }
45675
45607
  static descNeedsSkeleton(meshDesc) {
45676
- return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.subsets.length > 0 && meshDesc.fileMesh.skinning.skinnings.length > 0;
45608
+ return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.numskinnings > 0;
45677
45609
  }
45678
45610
  }
45679
45611
  const PartTypes = ["Part", "WedgePart"];
@@ -45823,12 +45755,8 @@ class ObjectDesc extends RenderDesc {
45823
45755
  const oldSize = this.originalScale;
45824
45756
  threeMesh.scale.set(this.size.X / oldSize.x, this.size.Y / oldSize.y, this.size.Z / oldSize.z);
45825
45757
  }
45826
- if (SkeletonDesc$1.descNeedsSkeleton(this.meshDesc)) {
45827
- if (FLAGS.USE_LOCAL_SKELETONDESC) {
45828
- this.skeletonDesc = new SkeletonDesc2(this, this.meshDesc, scene);
45829
- } else {
45830
- this.skeletonDesc = new SkeletonDesc$1(this, this.meshDesc, scene);
45831
- }
45758
+ if (SkeletonDesc.descNeedsSkeleton(this.meshDesc)) {
45759
+ this.skeletonDesc = new SkeletonDesc(this, this.meshDesc, scene);
45832
45760
  } else {
45833
45761
  this.meshDesc.fileMesh = void 0;
45834
45762
  }
@@ -47136,7 +47064,8 @@ class AnimatorWrapper extends InstanceWrapper {
47136
47064
  const result = await API.Asset.GetRBX(`rbxassetid://${id}`, void 0);
47137
47065
  if (result instanceof RBX) {
47138
47066
  log(false, "loading anim", id);
47139
- const animTrackInstance = result.generateTree().GetChildren()[0];
47067
+ const dataModel = result.generateTree();
47068
+ const animTrackInstance = dataModel.GetChildren()[0];
47140
47069
  if (animTrackInstance && humanoid.parent) {
47141
47070
  const animTrack = new AnimationTrack().loadAnimation(humanoid.parent, animTrackInstance);
47142
47071
  if (forceLoop) {
@@ -47147,7 +47076,10 @@ class AnimatorWrapper extends InstanceWrapper {
47147
47076
  }
47148
47077
  this.data.animationTracks.set(id, animTrack);
47149
47078
  this.instance.setProperty("_HasLoadedAnimation", true);
47079
+ dataModel.Destroy();
47150
47080
  return animTrack;
47081
+ } else {
47082
+ dataModel.Destroy();
47151
47083
  }
47152
47084
  } else {
47153
47085
  return result;
@@ -47170,7 +47102,8 @@ class AnimatorWrapper extends InstanceWrapper {
47170
47102
  if (!(animationInfo instanceof RBX)) {
47171
47103
  return animationInfo;
47172
47104
  }
47173
- const root = animationInfo.generateTree().GetChildren()[0];
47105
+ const dataModel = animationInfo.generateTree();
47106
+ const root = dataModel.GetChildren()[0];
47174
47107
  const promises = [];
47175
47108
  if (!isEmote) {
47176
47109
  for (const anim of root.GetChildren()) {
@@ -47240,6 +47173,7 @@ class AnimatorWrapper extends InstanceWrapper {
47240
47173
  }
47241
47174
  }
47242
47175
  }
47176
+ dataModel.Destroy();
47243
47177
  }
47244
47178
  /**
47245
47179
  * Switches to new animation
@@ -47305,14 +47239,16 @@ class AttachmentWrapper extends InstanceWrapper {
47305
47239
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
47306
47240
  if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
47307
47241
  }
47308
- getWorldCFrame() {
47242
+ getWorldCFrame(includeTransform = true) {
47309
47243
  if (this.instance.parent) {
47310
47244
  if (this.instance.parent.w?.IsA("BasePart")) {
47311
47245
  const parentCF = this.instance.parent.PropOrDefault("CFrame", new CFrame());
47312
- return parentCF.multiply(this.instance.Prop("CFrame"));
47246
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47247
+ return parentCF.multiply(this.instance.Prop("CFrame")).multiply(transform);
47313
47248
  } else if (this.instance.parent.w?.IsA("Attachment")) {
47314
47249
  const w = this.instance.parent.w;
47315
- return w.getWorldCFrame().multiply(this.instance.Prop("CFrame"));
47250
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47251
+ return w.getWorldCFrame().multiply(this.instance.Prop("CFrame")).multiply(transform);
47316
47252
  }
47317
47253
  }
47318
47254
  return this.instance.Prop("CFrame");
@@ -47322,25 +47258,6 @@ const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47322
47258
  __proto__: null,
47323
47259
  AttachmentWrapper
47324
47260
  }, Symbol.toStringTag, { value: "Module" }));
47325
- class BasePartWrapper extends InstanceWrapper {
47326
- static className = "BasePart";
47327
- static requiredProperties = [
47328
- "Name",
47329
- "CFrame",
47330
- "size",
47331
- "Transparency"
47332
- ];
47333
- setup() {
47334
- if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
47335
- if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
47336
- if (!this.instance.HasProperty("size")) this.instance.addProperty(new Property("size", DataType.Vector3), new Vector32());
47337
- if (!this.instance.HasProperty("Transparency")) this.instance.addProperty(new Property("Transparency", DataType.Float32), 0);
47338
- }
47339
- }
47340
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47341
- __proto__: null,
47342
- BasePartWrapper
47343
- }, Symbol.toStringTag, { value: "Module" }));
47344
47261
  class BodyColorsWrapper extends InstanceWrapper {
47345
47262
  static className = "BodyColors";
47346
47263
  static requiredProperties = [
@@ -47420,6 +47337,21 @@ const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47420
47337
  __proto__: null,
47421
47338
  BodyPartDescriptionWrapper
47422
47339
  }, Symbol.toStringTag, { value: "Module" }));
47340
+ class BoneWrapper extends AttachmentWrapper {
47341
+ static className = "Bone";
47342
+ static requiredProperties = [
47343
+ ...super.requiredProperties,
47344
+ "Transform"
47345
+ ];
47346
+ setup() {
47347
+ super.setup();
47348
+ if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
47349
+ }
47350
+ }
47351
+ const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47352
+ __proto__: null,
47353
+ BoneWrapper
47354
+ }, Symbol.toStringTag, { value: "Module" }));
47423
47355
  class DecalWrapper extends InstanceWrapper {
47424
47356
  static className = "Decal";
47425
47357
  static requiredProperties = [
@@ -47441,7 +47373,7 @@ class DecalWrapper extends InstanceWrapper {
47441
47373
  if (!this.instance.HasProperty("UVScale")) this.instance.addProperty(new Property("UVScale", DataType.Vector2), new Vector22());
47442
47374
  }
47443
47375
  }
47444
- const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47376
+ const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47445
47377
  __proto__: null,
47446
47378
  DecalWrapper
47447
47379
  }, Symbol.toStringTag, { value: "Module" }));
@@ -47585,7 +47517,7 @@ class MakeupDescriptionWrapper extends InstanceWrapper {
47585
47517
  if (!this.instance.HasProperty("Instance")) this.instance.addProperty(new Property("Instance", DataType.Referent), void 0);
47586
47518
  }
47587
47519
  }
47588
- const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47520
+ const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47589
47521
  __proto__: null,
47590
47522
  MakeupDescriptionWrapper
47591
47523
  }, Symbol.toStringTag, { value: "Module" }));
@@ -48285,7 +48217,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48285
48217
  moveAttachmentsToBase(child);
48286
48218
  }
48287
48219
  for (const childChild of child.GetChildren()) {
48288
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48220
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48289
48221
  childChild.Destroy();
48290
48222
  }
48291
48223
  }
@@ -48323,10 +48255,13 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48323
48255
  const head2 = dataModel.FindFirstChildOfClass("MeshPart");
48324
48256
  if (head2) {
48325
48257
  for (const childChild of head2.GetChildren()) {
48326
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48258
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48327
48259
  childChild.Destroy();
48328
48260
  }
48329
48261
  }
48262
+ if (!FLAGS.AVATAR_JOINT_UPGRADE) {
48263
+ moveAttachmentsToBase(head2);
48264
+ }
48330
48265
  replaceBodyPart(rig, head2);
48331
48266
  }
48332
48267
  }
@@ -48340,6 +48275,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48340
48275
  }
48341
48276
  resolve(void 0);
48342
48277
  }
48278
+ dataModel.Destroy();
48343
48279
  }
48344
48280
  });
48345
48281
  }));
@@ -48396,6 +48332,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48396
48332
  }
48397
48333
  }
48398
48334
  }
48335
+ dataModel.Destroy();
48399
48336
  resolve(void 0);
48400
48337
  } else {
48401
48338
  resolve(result);
@@ -48439,9 +48376,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48439
48376
  }
48440
48377
  asset.setParent(rig);
48441
48378
  } else {
48442
- dataModel.Destroy();
48443
48379
  warn(false, `Clothing asset does not exist or is invalid`);
48444
48380
  }
48381
+ dataModel.Destroy();
48445
48382
  resolve(void 0);
48446
48383
  } else {
48447
48384
  resolve(rbx);
@@ -48497,9 +48434,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48497
48434
  face.setParent(head);
48498
48435
  }
48499
48436
  } else {
48500
- dataModel.Destroy();
48501
48437
  warn(false, `Face asset does not exist or is invalid`);
48502
48438
  }
48439
+ dataModel.Destroy();
48503
48440
  } else {
48504
48441
  return rbx;
48505
48442
  }
@@ -48545,32 +48482,34 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48545
48482
  if (oldTool) {
48546
48483
  oldTool.Destroy();
48547
48484
  }
48548
- const handle = tool.FindFirstChild("Handle");
48549
- for (const child of tool.GetDescendants()) {
48550
- if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
48551
- if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
48552
- const part0 = child.Prop("Part0");
48553
- const part1 = child.Prop("Part1");
48554
- const c0 = child.Prop("C0");
48555
- const c1 = child.Prop("C1");
48556
- child.setProperty("Part0", part1, true);
48557
- child.setProperty("Part1", part0, true);
48558
- child.setProperty("C0", c1, true);
48559
- child.setProperty("C1", c0);
48560
- } else if (child.HasProperty("Part0") && child.Prop("Part0") === handle) ;
48561
- else {
48562
- child.Destroy();
48563
- }
48564
- if (!child.destroyed && child.PropOrDefault("Part0", void 0) == void 0 || child.PropOrDefault("Part1", void 0) === void 0) {
48565
- child.Destroy();
48485
+ if (!FLAGS.USE_ASSEMBLY) {
48486
+ const handle = tool.FindFirstChild("Handle");
48487
+ for (const child of tool.GetDescendants()) {
48488
+ if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
48489
+ if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
48490
+ const part0 = child.Prop("Part0");
48491
+ const part1 = child.Prop("Part1");
48492
+ const c0 = child.Prop("C0");
48493
+ const c1 = child.Prop("C1");
48494
+ child.setProperty("Part0", part1, true);
48495
+ child.setProperty("Part1", part0, true);
48496
+ child.setProperty("C0", c1, true);
48497
+ child.setProperty("C1", c0);
48498
+ } else if (child.HasProperty("Part0") && child.Prop("Part0") === handle) ;
48499
+ else {
48500
+ child.Destroy();
48501
+ }
48502
+ if (!child.destroyed && child.PropOrDefault("Part0", void 0) == void 0 || child.PropOrDefault("Part1", void 0) === void 0) {
48503
+ child.Destroy();
48504
+ }
48566
48505
  }
48567
48506
  }
48568
48507
  }
48569
48508
  tool.setParent(rig);
48570
48509
  } else {
48571
- dataModel.Destroy();
48572
48510
  warn(false, `Gear asset does not exist or is invalid`);
48573
48511
  }
48512
+ dataModel.Destroy();
48574
48513
  } else {
48575
48514
  return rbx;
48576
48515
  }
@@ -48660,9 +48599,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48660
48599
  accessoryDesc.setProperty("Instance", accessory);
48661
48600
  }
48662
48601
  } else {
48663
- dataModel.Destroy();
48664
48602
  warn(false, `Accessory asset does not exist or is invalid`);
48665
48603
  }
48604
+ dataModel.Destroy();
48666
48605
  resolve(void 0);
48667
48606
  } else {
48668
48607
  resolve(rbx);
@@ -48746,9 +48685,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48746
48685
  makeupDesc.setProperty("Instance", makeup);
48747
48686
  }
48748
48687
  } else {
48749
- dataModel.Destroy();
48750
48688
  warn(false, `Makeup asset does not exist or is invalid`);
48751
48689
  }
48690
+ dataModel.Destroy();
48752
48691
  resolve(void 0);
48753
48692
  } else {
48754
48693
  resolve(rbx);
@@ -48956,17 +48895,17 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48956
48895
  return this.instance;
48957
48896
  }
48958
48897
  }
48959
- const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48898
+ const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48960
48899
  __proto__: null,
48961
48900
  HumanoidDescriptionWrapper
48962
48901
  }, Symbol.toStringTag, { value: "Module" }));
48963
- class WeldWrapperData {
48902
+ class JointInstanceWrapperData {
48964
48903
  part0ChangedConnection;
48965
48904
  lastUpdateTime = 0;
48966
48905
  timeUpdates = 0;
48967
48906
  }
48968
- class WeldWrapper extends InstanceWrapper {
48969
- static className = "Weld";
48907
+ class JointInstanceWrapper extends InstanceWrapper {
48908
+ static className = "JointInstance";
48970
48909
  static requiredProperties = [
48971
48910
  "Name",
48972
48911
  "Enabled",
@@ -48983,7 +48922,7 @@ class WeldWrapper extends InstanceWrapper {
48983
48922
  if (!this.instance.HasProperty("Part1")) this.instance.addProperty(new Property("Part1", DataType.Referent), void 0);
48984
48923
  if (!this.instance.HasProperty("C0")) this.instance.addProperty(new Property("C0", DataType.CFrame), new CFrame());
48985
48924
  if (!this.instance.HasProperty("C1")) this.instance.addProperty(new Property("C1", DataType.CFrame), new CFrame());
48986
- if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new WeldWrapperData());
48925
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new JointInstanceWrapperData());
48987
48926
  }
48988
48927
  get data() {
48989
48928
  return this.instance.Prop("_data");
@@ -49004,10 +48943,42 @@ class WeldWrapper extends InstanceWrapper {
49004
48943
  if (FLAGS.LEGACY_WELD_BEHAVIOR) return;
49005
48944
  const part0 = this.instance.Prop("Part0");
49006
48945
  const part1 = this.instance.Prop("Part1");
49007
- if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
49008
- part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48946
+ if (!FLAGS.USE_ASSEMBLY) {
48947
+ if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
48948
+ part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48949
+ }
49009
48950
  }
49010
48951
  }
48952
+ getAssemblyOffset(includeTransform) {
48953
+ const part0 = this.instance.Prop("Part0");
48954
+ const part1 = this.instance.Prop("Part1");
48955
+ if (part0 && part1 && part0 !== part1) {
48956
+ const part0W = part0.w;
48957
+ const part1W = part1.w;
48958
+ if (part0W && part1W && part0W.IsA("BasePart") && part1W.IsA("BasePart")) {
48959
+ const c0 = this.instance.Prop("C0");
48960
+ const c1 = this.instance.Prop("C1");
48961
+ const transform = this.instance.PropOrDefault("Transform", new CFrame());
48962
+ const an0 = part0W.GetAssemblyNode();
48963
+ const an1 = part1W.GetAssemblyNode();
48964
+ const affectedPart = an0.depth <= an1.depth ? 1 : 0;
48965
+ if (affectedPart === 1) {
48966
+ if (includeTransform) {
48967
+ return c0.multiply(c1.multiply(transform).inverse());
48968
+ } else {
48969
+ return c0.multiply(c1.inverse());
48970
+ }
48971
+ } else if (affectedPart === 0) {
48972
+ if (includeTransform) {
48973
+ return c1.multiply(transform).multiply(c0.inverse());
48974
+ } else {
48975
+ return c1.multiply(c0.inverse());
48976
+ }
48977
+ }
48978
+ }
48979
+ }
48980
+ return new CFrame();
48981
+ }
49011
48982
  update(affectedPart = 1) {
49012
48983
  if (!this.instance.parent) return;
49013
48984
  if (this.data.lastUpdateTime === Date.now()) {
@@ -49059,14 +49030,14 @@ class WeldWrapper extends InstanceWrapper {
49059
49030
  }
49060
49031
  }
49061
49032
  }
49062
- const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49033
+ const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49063
49034
  __proto__: null,
49064
- WeldWrapper
49035
+ JointInstanceWrapper
49065
49036
  }, Symbol.toStringTag, { value: "Module" }));
49066
- class ManualWeldWrapper extends WeldWrapper {
49037
+ class ManualWeldWrapper extends JointInstanceWrapper {
49067
49038
  static className = "ManualWeld";
49068
49039
  }
49069
- const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49040
+ const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49070
49041
  __proto__: null,
49071
49042
  ManualWeldWrapper
49072
49043
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49081,7 +49052,7 @@ class MeshPartWrapper extends BasePartWrapper {
49081
49052
  if (!this.instance.HasProperty("DoubleSided")) this.instance.addProperty(new Property("DoubleSided", DataType.Bool), false);
49082
49053
  }
49083
49054
  }
49084
- const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49055
+ const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49085
49056
  __proto__: null,
49086
49057
  MeshPartWrapper
49087
49058
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49100,11 +49071,11 @@ class ModelWrapper extends InstanceWrapper {
49100
49071
  throw new Error("Model has no PrimaryPart");
49101
49072
  }
49102
49073
  }
49103
- const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49074
+ const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49104
49075
  __proto__: null,
49105
49076
  ModelWrapper
49106
49077
  }, Symbol.toStringTag, { value: "Module" }));
49107
- class Motor6DWrapper extends WeldWrapper {
49078
+ class Motor6DWrapper extends JointInstanceWrapper {
49108
49079
  static className = "Motor6D";
49109
49080
  static requiredProperties = [
49110
49081
  ...super.requiredProperties,
@@ -49115,7 +49086,7 @@ class Motor6DWrapper extends WeldWrapper {
49115
49086
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
49116
49087
  }
49117
49088
  }
49118
- const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49089
+ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49119
49090
  __proto__: null,
49120
49091
  Motor6DWrapper
49121
49092
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49130,7 +49101,7 @@ class PartWrapper extends BasePartWrapper {
49130
49101
  if (!this.instance.HasProperty("shape")) this.instance.addProperty(new Property("shape", DataType.Enum), PartType.Block);
49131
49102
  }
49132
49103
  }
49133
- const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49104
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49134
49105
  __proto__: null,
49135
49106
  PartWrapper
49136
49107
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49233,7 +49204,7 @@ class SoundWrapper extends InstanceWrapper {
49233
49204
  }
49234
49205
  }
49235
49206
  }
49236
- const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49207
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49237
49208
  __proto__: null,
49238
49209
  SoundWrapper
49239
49210
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49298,7 +49269,7 @@ class ScriptWrapper extends InstanceWrapper {
49298
49269
  }
49299
49270
  }
49300
49271
  }
49301
- const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49272
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49302
49273
  __proto__: null,
49303
49274
  ScriptWrapper
49304
49275
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49355,18 +49326,25 @@ class ToolWrapper extends InstanceWrapper {
49355
49326
  }
49356
49327
  }
49357
49328
  }
49358
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49329
+ const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49359
49330
  __proto__: null,
49360
49331
  ToolWrapper
49361
49332
  }, Symbol.toStringTag, { value: "Module" }));
49362
49333
  class WedgePartWrapper extends BasePartWrapper {
49363
49334
  static className = "WedgePart";
49364
49335
  }
49365
- const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49336
+ const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49366
49337
  __proto__: null,
49367
49338
  WedgePartWrapper
49368
49339
  }, Symbol.toStringTag, { value: "Module" }));
49369
- 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 });
49340
+ class WeldWrapper extends JointInstanceWrapper {
49341
+ static className = "Weld";
49342
+ }
49343
+ const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49344
+ __proto__: null,
49345
+ WeldWrapper
49346
+ }, Symbol.toStringTag, { value: "Module" }));
49347
+ 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 });
49370
49348
  function RegisterWrappers() {
49371
49349
  for (const module of Object.values(modules$1)) {
49372
49350
  for (const exprt of Object.values(module)) {
@@ -50304,7 +50282,7 @@ class EmitterGroupDesc extends RenderDesc {
50304
50282
  return this.results;
50305
50283
  }
50306
50284
  updateResults() {
50307
- const dt = specialClamp(this.time - this.lastTime, 0, 1 / 10);
50285
+ const dt = specialClamp(this.time - this.lastTime, 0, 1 / 10) * FLAGS.RENDERER_DELTA_TIME_MULTIPLIER;
50308
50286
  this.lastTime = this.time;
50309
50287
  for (const emitterDesc of this.emitterDescs) {
50310
50288
  emitterDesc.tick(dt, this);
@@ -51551,7 +51529,10 @@ class OutfitRenderer {
51551
51529
  this.currentRigType = newRigType;
51552
51530
  API.Asset.GetRBX(`roavatar://Rig${this.currentRigType}.rbxm`, void 0).then((result) => {
51553
51531
  if (result instanceof RBX) {
51554
- const newRig = result.generateTree().GetChildren()[0];
51532
+ const dataModel = result.generateTree();
51533
+ const newRig = dataModel.GetChildren()[0];
51534
+ newRig.setParent(void 0);
51535
+ dataModel.Destroy();
51555
51536
  this.currentRig = newRig;
51556
51537
  this.currentlyChangingRig = false;
51557
51538
  RBXRenderer.addInstance(this.currentRig, this.auth, this.renderScene);
@@ -51856,6 +51837,8 @@ export {
51856
51837
  AnimationPropToName,
51857
51838
  AnimationTrack,
51858
51839
  AnimatorWrapper,
51840
+ Assembly,
51841
+ AssemblyNode,
51859
51842
  Asset,
51860
51843
  AssetMeta,
51861
51844
  AssetType,
@@ -51866,6 +51849,7 @@ export {
51866
51849
  AttachmentWrapper,
51867
51850
  Authentication,
51868
51851
  AvatarType,
51852
+ BasePartWrapper,
51869
51853
  BodyColor3s,
51870
51854
  BodyColors,
51871
51855
  BodyColorsWrapper,
@@ -51873,6 +51857,7 @@ export {
51873
51857
  BodyPartDescriptionWrapper,
51874
51858
  BodyPartEnumToNames,
51875
51859
  BodyPartNameToEnum,
51860
+ BoneWrapper,
51876
51861
  BrickColors,
51877
51862
  BuildJoints,
51878
51863
  BundleTypes,
@@ -51886,6 +51871,7 @@ export {
51886
51871
  ColorSequence,
51887
51872
  ColorSequenceKeypoint,
51888
51873
  Connection,
51874
+ ConstraintWrapper,
51889
51875
  Content,
51890
51876
  ContentMap,
51891
51877
  DataType,
@@ -51901,7 +51887,6 @@ export {
51901
51887
  FaceControlsWrapper,
51902
51888
  FileMesh,
51903
51889
  FileMeshBone,
51904
- FileMeshSkinning,
51905
51890
  FileMeshSubset,
51906
51891
  FindFirstMatchingAttachment,
51907
51892
  FullBodyColors,
@@ -51915,6 +51900,7 @@ export {
51915
51900
  InstanceWrapper,
51916
51901
  ItemInfo,
51917
51902
  ItemSort,
51903
+ JointInstanceWrapper,
51918
51904
  LODS,
51919
51905
  LayeredAssetTypes,
51920
51906
  LayeredClothingAssetOrder,
@@ -51925,6 +51911,7 @@ export {
51925
51911
  ManualWeldWrapper,
51926
51912
  MaxOneOfAssetTypes,
51927
51913
  MaxPerAsset,
51914
+ MeshPartWrapper,
51928
51915
  MeshType,
51929
51916
  ModelWrapper,
51930
51917
  Motor6DWrapper,
@@ -51937,6 +51924,7 @@ export {
51937
51924
  OutfitOrigin,
51938
51925
  OutfitRenderer,
51939
51926
  PartType,
51927
+ PartWrapper,
51940
51928
  ParticleEmitterShapeInOut,
51941
51929
  ParticleFlipbookLayout,
51942
51930
  ParticleFlipbookMode,
@@ -51975,6 +51963,7 @@ export {
51975
51963
  Vector32 as Vector3,
51976
51964
  Wait,
51977
51965
  WearableAssetTypes,
51966
+ WedgePartWrapper,
51978
51967
  WeldWrapper,
51979
51968
  WorkerTypeToFunction,
51980
51969
  WrapLayerAutoSkin,
@@ -52036,8 +52025,11 @@ export {
52036
52025
  getOriginalAttachmentOrientation,
52037
52026
  getOriginalAttachmentPosition,
52038
52027
  getOriginalSize,
52028
+ getPartAssemblyScore,
52029
+ getPartsInAssembly_Generate,
52039
52030
  getRandomBetweenInclusive,
52040
52031
  getRigExtentsWorld,
52032
+ getRootAssemblyPart_Generate,
52041
52033
  getThumbnailCameraCFrame,
52042
52034
  getUVtoIndexMap,
52043
52035
  getUVtoIndicesMap,