roavatar-renderer 1.5.8 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -29099,77 +29099,35 @@ function inheritUV(to, from) {
29099
29099
  }
29100
29100
  }
29101
29101
  function transferSkeleton(to, from) {
29102
- if (from.skinning.skinnings.length < 1) {
29102
+ if (from.skinning.numskinnings < 1) {
29103
29103
  warn(false, `From mesh has no skeleton that can be inherited`);
29104
29104
  return;
29105
29105
  }
29106
29106
  to.skinning = from.skinning.clone();
29107
- to.skinning.numSkinnings = to.coreMesh.numverts;
29108
- to.skinning.skinnings = new Array(to.skinning.numSkinnings);
29107
+ to.skinning.numskinnings = to.coreMesh.numverts;
29109
29108
  const distIndexArr = getDistIndexArray(to, from);
29110
- const newSkinDatas = new Array(to.coreMesh.numverts);
29111
29109
  for (let i = 0; i < to.coreMesh.numverts; i++) {
29112
29110
  let closestI = distIndexArr[i];
29113
29111
  if (closestI === void 0) {
29114
29112
  warn(false, "did not find matching vert during transfer");
29115
29113
  closestI = 0;
29116
29114
  }
29117
- const closestSkinning = from.skinning.skinnings[closestI];
29118
- const closestSubsetIndex = from.skinning.getSubsetIndex(closestI);
29119
- newSkinDatas[i] = [closestSubsetIndex, closestSkinning, i];
29115
+ const closestSkinning = closestI;
29116
+ to.skinning.setIndex(i, from.skinning.getIndex(closestSkinning));
29117
+ to.skinning.setWeight(i, from.skinning.getWeight(closestSkinning));
29120
29118
  }
29121
- newSkinDatas.sort((a, b) => {
29122
- return a[0] - b[0];
29123
- });
29124
- const newSubsets = [];
29125
- const newVerts = [];
29126
- const newSkinnings = [];
29127
- const toSubsetToFromSubsetMap = /* @__PURE__ */ new Map();
29128
- for (let i = 0; i < newSkinDatas.length; i++) {
29129
- const newSkinData = newSkinDatas[i];
29130
- const currentSubset = newSubsets[newSubsets.length - 1];
29131
- const vertSubset = from.skinning.subsets[newSkinData[0]];
29132
- const skinning = newSkinData[1].clone();
29133
- if (toSubsetToFromSubsetMap.get(currentSubset) !== vertSubset) {
29134
- const toPush = vertSubset.clone();
29135
- newSubsets.push(toPush);
29136
- toSubsetToFromSubsetMap.set(toPush, vertSubset);
29137
- toPush.vertsBegin = i;
29138
- toPush.vertsLength = 1;
29139
- } else {
29140
- currentSubset.vertsLength += 1;
29141
- }
29142
- newVerts.push(newSkinData[2]);
29143
- newSkinnings.push(skinning);
29144
- }
29145
- for (let i = 0; i < to.coreMesh.numfaces; i++) {
29146
- const face = to.coreMesh.getFace(i);
29147
- to.coreMesh.setFace(i, [
29148
- newVerts.indexOf(face[0]),
29149
- newVerts.indexOf(face[1]),
29150
- newVerts.indexOf(face[2])
29151
- ]);
29152
- }
29153
- to.coreMesh.onlyVerts(newVerts);
29154
- to.skinning.subsets = [];
29155
- for (const subset of newSubsets) {
29156
- to.skinning.subsets.push(subset.clone());
29157
- }
29158
- to.skinning.skinnings = newSkinnings;
29159
29119
  if (from.facs) {
29160
29120
  to.facs = from.facs.clone();
29161
29121
  }
29162
29122
  }
29163
29123
  function inheritSkeleton(to, from) {
29164
- if (from.skinning.skinnings.length < 1) {
29124
+ if (from.skinning.numskinnings < 1) {
29165
29125
  warn(false, `From mesh has no skeleton that can be inherited`);
29166
29126
  return;
29167
29127
  }
29168
29128
  to.skinning = from.skinning.clone();
29169
- to.skinning.numSkinnings = to.coreMesh.numverts;
29170
- to.skinning.skinnings = new Array(to.skinning.numSkinnings);
29129
+ to.skinning.numskinnings = to.coreMesh.numverts;
29171
29130
  const vertKD = buildVertKD(from);
29172
- const newSkinDatas = new Array(to.coreMesh.numverts);
29173
29131
  for (let i = 0; i < to.coreMesh.numverts; i++) {
29174
29132
  let normal = to.coreMesh.getNormal(i);
29175
29133
  if (isNaN(normal[0]) || isNaN(normal[1]) || isNaN(normal[2])) {
@@ -29179,49 +29137,10 @@ function inheritSkeleton(to, from) {
29179
29137
  const toSearch = minus(toVertPos, multiply(normal, [0, 0, 0]));
29180
29138
  const closest = nearestSearch(vertKD, toSearch);
29181
29139
  const closestI = closest.index;
29182
- const closestSkinning = from.skinning.skinnings[closestI];
29183
- const closestSubsetIndex = from.skinning.getSubsetIndex(closestI);
29184
- newSkinDatas[i] = [closestSubsetIndex, closestSkinning, i];
29185
- }
29186
- newSkinDatas.sort((a, b) => {
29187
- return a[0] - b[0];
29188
- });
29189
- const newSubsets = [];
29190
- const newVerts = [];
29191
- const newSkinnings = [];
29192
- const toSubsetToFromSubsetMap = /* @__PURE__ */ new Map();
29193
- for (let i = 0; i < newSkinDatas.length; i++) {
29194
- const newSkinData = newSkinDatas[i];
29195
- const currentSubset = newSubsets[newSubsets.length - 1];
29196
- const vertSubset = from.skinning.subsets[newSkinData[0]];
29197
- const toVertIndex = newSkinData[2];
29198
- const skinning = newSkinData[1].clone();
29199
- if (toSubsetToFromSubsetMap.get(currentSubset) !== vertSubset) {
29200
- const toPush = vertSubset.clone();
29201
- newSubsets.push(toPush);
29202
- toSubsetToFromSubsetMap.set(toPush, vertSubset);
29203
- toPush.vertsBegin = i;
29204
- toPush.vertsLength = 1;
29205
- } else {
29206
- currentSubset.vertsLength += 1;
29207
- }
29208
- newVerts.push(toVertIndex);
29209
- newSkinnings.push(skinning);
29210
- }
29211
- for (let i = 0; i < to.coreMesh.numfaces; i++) {
29212
- const face = to.coreMesh.getFace(i);
29213
- to.coreMesh.setFace(i, [
29214
- newVerts.indexOf(face[0]),
29215
- newVerts.indexOf(face[1]),
29216
- newVerts.indexOf(face[2])
29217
- ]);
29218
- }
29219
- to.coreMesh.onlyVerts(newVerts);
29220
- to.skinning.subsets = [];
29221
- for (const subset of newSubsets) {
29222
- to.skinning.subsets.push(subset.clone());
29140
+ const closestSkinning = closestI;
29141
+ to.skinning.setIndex(i, from.skinning.getIndex(closestSkinning));
29142
+ to.skinning.setWeight(i, from.skinning.getWeight(closestSkinning));
29223
29143
  }
29224
- to.skinning.skinnings = newSkinnings;
29225
29144
  if (from.facs) {
29226
29145
  to.facs = from.facs.clone();
29227
29146
  }
@@ -29264,6 +29183,7 @@ function offsetMesh(mesh, cframe) {
29264
29183
  }
29265
29184
  for (const bone of mesh.skinning.bones) {
29266
29185
  bone.position = add(bone.position, cframe.Position);
29186
+ bone.sourceOffset.Position = add(bone.sourceOffset.Position, cframe.Position);
29267
29187
  }
29268
29188
  }
29269
29189
  function scaleMesh(mesh, scale) {
@@ -29272,6 +29192,7 @@ function scaleMesh(mesh, scale) {
29272
29192
  }
29273
29193
  for (const bone of mesh.skinning.bones) {
29274
29194
  bone.position = new Vector32().fromVec3(bone.position).multiply(scale).toVec3();
29195
+ bone.sourceScaled = multiply(bone.sourceScaled, scale.toVec3());
29275
29196
  }
29276
29197
  }
29277
29198
  function offsetMeshWithRotation(mesh, cframe) {
@@ -29282,6 +29203,7 @@ function offsetMeshWithRotation(mesh, cframe) {
29282
29203
  for (const bone of mesh.skinning.bones) {
29283
29204
  const boneCF = new CFrame(...bone.position);
29284
29205
  bone.position = cframe.multiply(boneCF).Position;
29206
+ bone.sourceOffset = cframe.multiply(bone.sourceOffset);
29285
29207
  }
29286
29208
  }
29287
29209
  function getOffsetArray(inner, outer) {
@@ -29892,6 +29814,8 @@ const FLAGS = {
29892
29814
  //dom
29893
29815
  AVATAR_JOINT_UPGRADE: false,
29894
29816
  INSTANCE_GARBAGE_COLLECT: false,
29817
+ LEGACY_WELD_BEHAVIOR: false,
29818
+ USE_ASSEMBLY: true,
29895
29819
  //api
29896
29820
  BODYCOLOR3: true,
29897
29821
  ENABLE_API_CACHE: true,
@@ -29906,6 +29830,7 @@ const FLAGS = {
29906
29830
  API_REQUEST_PREFIX: "",
29907
29831
  INCLUDE_REQUEST_CREDENTIALS_OVERRIDE: "include",
29908
29832
  API_REQUEST_RETRY: true,
29833
+ FETCH_FUNC: void 0,
29909
29834
  //assets
29910
29835
  ONLINE_ASSETS: false,
29911
29836
  ASSETS_PATH: "../assets/rbxasset/",
@@ -29933,7 +29858,6 @@ const FLAGS = {
29933
29858
  //does this count as anti aliasing?
29934
29859
  GEAR_ENABLED: true,
29935
29860
  AUDIO_ENABLED: true,
29936
- LEGACY_WELD_BEHAVIOR: false,
29937
29861
  USE_RENDERTARGET: true,
29938
29862
  AUTO_RESTORE_CONTEXT: true,
29939
29863
  RENDERTARGET_TO_CANVASTEXTURE: false,
@@ -29941,6 +29865,7 @@ const FLAGS = {
29941
29865
  ALWAYS_SHOW_ATTACHMENTS: false,
29942
29866
  //skeleton
29943
29867
  SHOW_SKELETON_HELPER: false,
29868
+ SKELETON_HELPER_INSTANCE_NAME: void 0,
29944
29869
  UPDATE_SKELETON: true,
29945
29870
  ANIMATE_SKELETON: true,
29946
29871
  AUTO_SKIN_EVERYTHING: false,
@@ -30001,10 +29926,12 @@ class InstanceWrapper {
30001
29926
  if (this.instance.className !== this.static().className) {
30002
29927
  throw new Error(`Provided Instance is not a ${this.static().className}`);
30003
29928
  }
29929
+ if (this.instance.wrapperInitialized) return;
30004
29930
  const propertyNames = this.instance.getPropertyNames();
30005
29931
  const hasAllProperties = this.static().requiredProperties.every((value) => propertyNames.includes(value));
30006
29932
  if (!hasAllProperties) {
30007
29933
  this.setup();
29934
+ this.instance.wrapperInitialized = true;
30008
29935
  const newPropertyNames = this.instance.getPropertyNames();
30009
29936
  const hasAllProperties2 = this.static().requiredProperties.every((value) => newPropertyNames.includes(value));
30010
29937
  if (!hasAllProperties2) {
@@ -30052,7 +29979,7 @@ class InstanceWrapper {
30052
29979
  preRender() {
30053
29980
  }
30054
29981
  }
30055
- const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29982
+ const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30056
29983
  __proto__: null,
30057
29984
  GetWrapperForInstance,
30058
29985
  InstanceWrapper
@@ -30541,6 +30468,7 @@ class Instance {
30541
30468
  parent = void 0;
30542
30469
  destroyed = false;
30543
30470
  _hasWrappered = false;
30471
+ wrapperInitialized = false;
30544
30472
  //private _canGC: boolean = true
30545
30473
  classID;
30546
30474
  //dont use this to identify instance class, it is only used during file loading
@@ -30551,6 +30479,7 @@ class Instance {
30551
30479
  Destroying = new Event();
30552
30480
  Changed = new Event();
30553
30481
  AncestryChanged = new Event();
30482
+ referencedByChanged = new Event();
30554
30483
  constructor(className, notComplete = false) {
30555
30484
  this._id = lastInstanceId;
30556
30485
  lastInstanceId++;
@@ -30600,6 +30529,7 @@ class Instance {
30600
30529
  if (!this._referencedBy.includes(instance)) {
30601
30530
  this._referencedBy.push(instance);
30602
30531
  }
30532
+ this.referencedByChanged.Fire();
30603
30533
  }
30604
30534
  removeReferencedBy(instance) {
30605
30535
  const index = this._referencedBy.indexOf(instance);
@@ -30613,9 +30543,13 @@ class Instance {
30613
30543
  }
30614
30544
  if (!isReferenced) {
30615
30545
  this._referencedBy.splice(index, 1);
30546
+ this.referencedByChanged.Fire();
30616
30547
  }
30617
30548
  }
30618
30549
  }
30550
+ getReferencedBy() {
30551
+ return [...this._referencedBy];
30552
+ }
30619
30553
  addProperty(property, value) {
30620
30554
  if (!property.name) {
30621
30555
  error(property);
@@ -30788,6 +30722,7 @@ class Instance {
30788
30722
  this.parent = instance;
30789
30723
  if (originalParent && originalParent !== instance) {
30790
30724
  originalParent.ChildRemoved.Fire(this);
30725
+ originalParent.AncestryChanged.Fire(this);
30791
30726
  }
30792
30727
  if (instance) {
30793
30728
  instance._children.push(this);
@@ -30811,6 +30746,7 @@ class Instance {
30811
30746
  this.Destroying.Clear();
30812
30747
  this.Changed.Clear();
30813
30748
  this.AncestryChanged.Clear();
30749
+ this.referencedByChanged.Clear();
30814
30750
  this.setParent(null);
30815
30751
  for (const child of this.GetChildren()) {
30816
30752
  child.Destroy();
@@ -30818,7 +30754,7 @@ class Instance {
30818
30754
  for (const property of this.getPropertyNames()) {
30819
30755
  this.setProperty(property, null);
30820
30756
  }
30821
- for (const instance of this._referencedBy) {
30757
+ for (const instance of this.getReferencedBy()) {
30822
30758
  for (const propertyName of instance.getPropertyNames()) {
30823
30759
  if (instance.Property(propertyName) === this) {
30824
30760
  instance.setProperty(propertyName, null);
@@ -30892,6 +30828,13 @@ class Instance {
30892
30828
  }
30893
30829
  return lastChild;
30894
30830
  }
30831
+ IsA(className) {
30832
+ const wrapper = this.w;
30833
+ if (wrapper) {
30834
+ return wrapper.IsA(className);
30835
+ }
30836
+ return false;
30837
+ }
30895
30838
  preRender() {
30896
30839
  const wrapper = GetWrapperForInstance(this);
30897
30840
  if (wrapper) {
@@ -34550,6 +34493,7 @@ class HSRAVIS {
34550
34493
  }
34551
34494
  }
34552
34495
  class FileMeshBone {
34496
+ name;
34553
34497
  boneNameIndex = 0;
34554
34498
  //uint
34555
34499
  parentIndex = 0;
@@ -34561,14 +34505,24 @@ class FileMeshBone {
34561
34505
  rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
34562
34506
  //3x3, world space, y up, -z forward
34563
34507
  position = [0, 0, 0];
34508
+ //metadata so skeletondesc knows what autoskin has done
34509
+ sourcePart;
34510
+ sourceOffset = new CFrame();
34511
+ sourceSize;
34512
+ sourceScaled = [1, 1, 1];
34564
34513
  clone() {
34565
34514
  const copy = new FileMeshBone();
34515
+ copy.name = this.name;
34566
34516
  copy.boneNameIndex = this.boneNameIndex;
34567
34517
  copy.parentIndex = this.parentIndex;
34568
34518
  copy.lodParentIndex = this.lodParentIndex;
34569
34519
  copy.culling = this.culling;
34570
34520
  copy.rotationMatrix = clonePrimitiveArray(this.rotationMatrix);
34571
34521
  copy.position = clonePrimitiveArray(this.position);
34522
+ copy.sourcePart = this.sourcePart;
34523
+ copy.sourceOffset = this.sourceOffset.clone();
34524
+ if (this.sourceSize) copy.sourceSize = clonePrimitiveArray(this.sourceSize);
34525
+ copy.sourceScaled = clonePrimitiveArray(this.sourceScaled);
34572
34526
  return copy;
34573
34527
  }
34574
34528
  }
@@ -34596,71 +34550,105 @@ class FileMeshSubset {
34596
34550
  return copy;
34597
34551
  }
34598
34552
  }
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
34553
  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
34554
+ _numskinnings = 0;
34555
+ _indices = new Uint16Array();
34556
+ _weights = new Float32Array();
34618
34557
  bones = [];
34619
- //FileMeshBone[]
34620
- nameTableSize = 0;
34621
- //uint
34622
- nameTable = [];
34623
- //string[]
34624
- numSubsets = 0;
34625
- //uint
34626
- subsets = [];
34627
- //FileMeshSubset[]
34628
34558
  clone() {
34629
34559
  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;
34560
+ copy._numskinnings = this._numskinnings;
34561
+ copy._indices = this._indices.slice();
34562
+ copy._weights = this._weights.slice();
34636
34563
  copy.bones = new Array(this.bones.length);
34637
34564
  for (let i = 0; i < this.bones.length; i++) {
34638
34565
  copy.bones[i] = this.bones[i].clone();
34639
34566
  }
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
34567
  return copy;
34648
34568
  }
34649
- getBone(boneName) {
34650
- const boneIndex = this.nameTable.indexOf(boneName);
34651
- if (boneIndex > -1) {
34652
- return this.bones[boneIndex];
34569
+ get numskinnings() {
34570
+ return this._numskinnings;
34571
+ }
34572
+ set numskinnings(value) {
34573
+ this._numskinnings = value;
34574
+ this._indices = new Uint16Array(value * 4);
34575
+ this._weights = new Float32Array(value * 4);
34576
+ }
34577
+ get indices() {
34578
+ return this._indices;
34579
+ }
34580
+ get weights() {
34581
+ return this._weights;
34582
+ }
34583
+ getIndex(i) {
34584
+ return [
34585
+ this._indices[i * 4 + 0],
34586
+ this._indices[i * 4 + 1],
34587
+ this._indices[i * 4 + 2],
34588
+ this._indices[i * 4 + 3]
34589
+ ];
34590
+ }
34591
+ setIndex(i, value) {
34592
+ this._indices[i * 4 + 0] = value[0];
34593
+ this._indices[i * 4 + 1] = value[1];
34594
+ this._indices[i * 4 + 2] = value[2];
34595
+ this._indices[i * 4 + 3] = value[3];
34596
+ }
34597
+ getWeight(i) {
34598
+ return [
34599
+ this._weights[i * 4 + 0],
34600
+ this._weights[i * 4 + 1],
34601
+ this._weights[i * 4 + 2],
34602
+ this._weights[i * 4 + 3]
34603
+ ];
34604
+ }
34605
+ setWeight(i, value) {
34606
+ this._weights[i * 4 + 0] = value[0];
34607
+ this._weights[i * 4 + 1] = value[1];
34608
+ this._weights[i * 4 + 2] = value[2];
34609
+ this._weights[i * 4 + 3] = value[3];
34610
+ }
34611
+ readSkinning(view, i) {
34612
+ this.setIndex(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34613
+ this.setWeight(i, [view.readUint8(), view.readUint8(), view.readUint8(), view.readUint8()]);
34614
+ }
34615
+ increaseSkinnings(add2) {
34616
+ const newSize = this.numskinnings + add2;
34617
+ const ogIndices = this._indices;
34618
+ const ogWeights = this._weights;
34619
+ this.numskinnings = newSize;
34620
+ this._indices.set(ogIndices);
34621
+ this._weights.set(ogWeights);
34622
+ }
34623
+ onlySkinnings(only) {
34624
+ const newSize = only.length;
34625
+ const ogIndices = this._indices;
34626
+ const ogWeights = this._weights;
34627
+ this.numskinnings = newSize;
34628
+ for (let i = 0; i < only.length; i++) {
34629
+ const j = only[i];
34630
+ const ogIndex = [
34631
+ ogIndices[j * 4 + 0],
34632
+ ogIndices[j * 4 + 1],
34633
+ ogIndices[j * 4 + 2],
34634
+ ogIndices[j * 4 + 3]
34635
+ ];
34636
+ const ogWeight = [
34637
+ ogWeights[j * 4 + 0],
34638
+ ogWeights[j * 4 + 1],
34639
+ ogWeights[j * 4 + 2],
34640
+ ogWeights[j * 4 + 3]
34641
+ ];
34642
+ this.setIndex(i, ogIndex);
34643
+ this.setWeight(i, ogWeight);
34653
34644
  }
34654
34645
  }
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;
34646
+ getBone(name) {
34647
+ for (const bone of this.bones) {
34648
+ if (bone.name === name) {
34649
+ return bone;
34660
34650
  }
34661
34651
  }
34662
- error(this);
34663
- throw new Error(`There is no subset for vert index ${vertIndex}`);
34664
34652
  }
34665
34653
  }
34666
34654
  class QuantizedMatrix {
@@ -34757,12 +34745,6 @@ function readBone(view) {
34757
34745
  bone.position = [view.readFloat32(), view.readFloat32(), view.readFloat32()];
34758
34746
  return bone;
34759
34747
  }
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
34748
  function readQuantizedMatrix(view) {
34767
34749
  const version = view.readUint16();
34768
34750
  const rows = view.readUint32();
@@ -34986,28 +34968,46 @@ class FileMesh {
34986
34968
  }
34987
34969
  readChunkSKINNING(view, version) {
34988
34970
  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));
34971
+ this.skinning.numskinnings = view.readUint32();
34972
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
34973
+ this.skinning.readSkinning(view, i);
34992
34974
  }
34993
- this.skinning.numBones = view.readUint32();
34994
- for (let i = 0; i < this.skinning.numBones; i++) {
34975
+ const numBones = view.readUint32();
34976
+ for (let i = 0; i < numBones; i++) {
34995
34977
  this.skinning.bones.push(readBone(view));
34996
34978
  }
34997
- this.skinning.nameTableSize = view.readUint32();
34979
+ const nameTableSize = view.readUint32();
34980
+ const nameTable = [];
34981
+ const nameTableIndex = [];
34998
34982
  let lastString = "";
34999
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
34983
+ for (let i = 0; i < nameTableSize; i++) {
35000
34984
  if (view.readUint8() !== 0) {
35001
34985
  view.viewOffset--;
35002
34986
  lastString += view.readUtf8String(1);
35003
34987
  } else {
35004
- this.skinning.nameTable.push(lastString);
34988
+ nameTable.push(lastString);
34989
+ nameTableIndex.push(i - lastString.length);
35005
34990
  lastString = "";
35006
34991
  }
35007
34992
  }
35008
- this.skinning.numSubsets = view.readUint32();
35009
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35010
- this.skinning.subsets.push(readSubset(view));
34993
+ for (const bone of this.skinning.bones) {
34994
+ for (let i = 0; i < nameTable.length; i++) {
34995
+ if (nameTableIndex[i] === bone.boneNameIndex) {
34996
+ bone.name = nameTable[i];
34997
+ break;
34998
+ }
34999
+ }
35000
+ }
35001
+ const numSubsets = view.readUint32();
35002
+ for (let i = 0; i < numSubsets; i++) {
35003
+ const subset = readSubset(view);
35004
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35005
+ const indices = this.skinning.getIndex(i2);
35006
+ const newIndices = indices.map((v) => {
35007
+ return subset.boneIndices[v];
35008
+ });
35009
+ this.skinning.setIndex(i2, newIndices);
35010
+ }
35011
35011
  }
35012
35012
  }
35013
35013
  readChunkHSRAVIS(view, version) {
@@ -35201,9 +35201,9 @@ class FileMesh {
35201
35201
  this.coreMesh.numverts = view.readUint32();
35202
35202
  this.coreMesh.numfaces = view.readUint32();
35203
35203
  this.lods.numLodOffsets = view.readUint16();
35204
- this.skinning.numBones = view.readUint16();
35205
- this.skinning.nameTableSize = view.readUint32();
35206
- this.skinning.numSubsets = view.readUint16();
35204
+ const numBones = view.readUint16();
35205
+ const nameTableSize = view.readUint32();
35206
+ const numSubsets = view.readUint16();
35207
35207
  this.lods.numHighQualityLODs = view.readInt8();
35208
35208
  view.readInt8();
35209
35209
  if (version === "version 5.00\n") {
@@ -35213,9 +35213,10 @@ class FileMesh {
35213
35213
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35214
35214
  this.coreMesh.readVert(i, view);
35215
35215
  }
35216
- if (this.skinning.numBones > 0) {
35217
- for (let i = 0; i < this.coreMesh.numverts; i++) {
35218
- this.skinning.skinnings.push(readSkinning(view));
35216
+ if (numBones > 0) {
35217
+ this.skinning.numskinnings = this.coreMesh.numverts;
35218
+ for (let i = 0; i < this.skinning.numskinnings; i++) {
35219
+ this.skinning.readSkinning(view, i);
35219
35220
  }
35220
35221
  }
35221
35222
  for (let i = 0; i < this.coreMesh.numfaces; i++) {
@@ -35224,21 +35225,39 @@ class FileMesh {
35224
35225
  for (let i = 0; i < this.lods.numLodOffsets; i++) {
35225
35226
  this.lods.lodOffsets.push(view.readUint32());
35226
35227
  }
35227
- for (let i = 0; i < this.skinning.numBones; i++) {
35228
+ for (let i = 0; i < numBones; i++) {
35228
35229
  this.skinning.bones.push(readBone(view));
35229
35230
  }
35231
+ const nameTable = [];
35232
+ const nameTableIndex = [];
35230
35233
  let lastString = "";
35231
- for (let i = 0; i < this.skinning.nameTableSize; i++) {
35234
+ for (let i = 0; i < nameTableSize; i++) {
35232
35235
  if (view.readUint8() !== 0) {
35233
35236
  view.viewOffset--;
35234
35237
  lastString += view.readUtf8String(1);
35235
35238
  } else {
35236
- this.skinning.nameTable.push(lastString);
35239
+ nameTable.push(lastString);
35240
+ nameTableIndex.push(i - lastString.length);
35237
35241
  lastString = "";
35238
35242
  }
35239
35243
  }
35240
- for (let i = 0; i < this.skinning.numSubsets; i++) {
35241
- this.skinning.subsets.push(readSubset(view));
35244
+ for (const bone of this.skinning.bones) {
35245
+ for (let i = 0; i < nameTable.length; i++) {
35246
+ if (nameTableIndex[i] === bone.boneNameIndex) {
35247
+ bone.name = nameTable[i];
35248
+ break;
35249
+ }
35250
+ }
35251
+ }
35252
+ for (let i = 0; i < numSubsets; i++) {
35253
+ const subset = readSubset(view);
35254
+ for (let i2 = subset.vertsBegin; i2 < subset.vertsBegin + subset.vertsLength; i2++) {
35255
+ const indices = this.skinning.getIndex(i2);
35256
+ const newIndices = indices.map((v) => {
35257
+ return subset.boneIndices[v];
35258
+ });
35259
+ this.skinning.setIndex(i2, newIndices);
35260
+ }
35242
35261
  }
35243
35262
  if (version === "version 5.00\n" && this.facsDataFormat === 1 && this.sizeOfFacsData > 0) {
35244
35263
  this.facs = readFACS(view);
@@ -35259,6 +35278,9 @@ class FileMesh {
35259
35278
  warn(true, `Issue with parsed mesh: ${issue}`);
35260
35279
  }
35261
35280
  log(false, `Bytes left: ${view.view.byteLength - view.viewOffset}`);
35281
+ if (this.skinning.numskinnings > 0) {
35282
+ log(false, this.skinning);
35283
+ }
35262
35284
  }
35263
35285
  stripLODS() {
35264
35286
  let facesEnd = this.coreMesh.numfaces;
@@ -35277,28 +35299,16 @@ class FileMesh {
35277
35299
  }
35278
35300
  padSkinnings() {
35279
35301
  const vertsLength = this.coreMesh.numverts;
35280
- const skinningsLength = this.skinning.skinnings.length;
35302
+ const skinningsLength = this.skinning.numskinnings;
35281
35303
  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;
35304
+ this.skinning.increaseSkinnings(missingCount);
35305
+ for (let i = skinningsLength; i < vertsLength; i++) {
35306
+ this.skinning.setIndex(i, [0, 0, 0, 0]);
35307
+ this.skinning.setWeight(i, [0, 0, 0, 0]);
35299
35308
  }
35300
35309
  if (this.skinning.bones.length === 0) {
35301
35310
  const bone = new FileMeshBone();
35311
+ bone.name = "Root";
35302
35312
  bone.boneNameIndex = 0;
35303
35313
  bone.lodParentIndex = 65535;
35304
35314
  bone.parentIndex = 65535;
@@ -35307,11 +35317,21 @@ class FileMesh {
35307
35317
  this.skinning.bones.push(bone);
35308
35318
  }
35309
35319
  }
35320
+ setBoneSource(name) {
35321
+ for (const bone of this.skinning.bones) {
35322
+ bone.sourcePart = name;
35323
+ }
35324
+ }
35325
+ setBoneSourceSize() {
35326
+ for (const bone of this.skinning.bones) {
35327
+ bone.sourceSize = this.size;
35328
+ }
35329
+ }
35310
35330
  combine(other) {
35311
35331
  this.stripLODS();
35312
35332
  other = other.clone();
35313
35333
  other.stripLODS();
35314
- if (this.skinning.skinnings.length > 0 || other.skinning.skinnings.length > 0) {
35334
+ if (this.skinning.numskinnings > 0 || other.skinning.numskinnings > 0) {
35315
35335
  this.padSkinnings();
35316
35336
  other.padSkinnings();
35317
35337
  }
@@ -35335,8 +35355,7 @@ class FileMesh {
35335
35355
  }
35336
35356
  const boneIndexMap = /* @__PURE__ */ new Map();
35337
35357
  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);
35358
+ const foundBone = bone.name ? this.skinning.getBone(bone.name) : void 0;
35340
35359
  if (bone.parentIndex >= 65535) {
35341
35360
  boneIndexMap.set(other.skinning.bones.indexOf(bone), 0);
35342
35361
  continue;
@@ -35345,8 +35364,8 @@ class FileMesh {
35345
35364
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.indexOf(foundBone));
35346
35365
  } else {
35347
35366
  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);
35367
+ const parentName = parentBone.name;
35368
+ const foundParentBone = parentName ? this.skinning.getBone(parentName) : void 0;
35350
35369
  const boneCopy = bone.clone();
35351
35370
  boneCopy.parentIndex = 65535;
35352
35371
  boneCopy.lodParentIndex = 65535;
@@ -35355,31 +35374,20 @@ class FileMesh {
35355
35374
  boneCopy.parentIndex = foundParentIndex;
35356
35375
  boneCopy.lodParentIndex = foundParentIndex;
35357
35376
  }
35358
- this.skinning.nameTable.push(boneName);
35359
35377
  this.skinning.bones.push(boneCopy);
35360
35378
  boneIndexMap.set(other.skinning.bones.indexOf(bone), this.skinning.bones.length - 1);
35361
35379
  }
35362
35380
  }
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);
35381
+ const ogSkinningsSize = this.skinning.numskinnings;
35382
+ this.skinning.increaseSkinnings(other.skinning.numskinnings);
35383
+ for (let i = 0; i < other.skinning.numskinnings; i++) {
35384
+ this.skinning.setIndex(
35385
+ ogSkinningsSize + i,
35386
+ other.skinning.getIndex(i).map((v) => {
35387
+ return boneIndexMap.get(v);
35388
+ })
35389
+ );
35390
+ this.skinning.setWeight(ogSkinningsSize + i, other.skinning.getWeight(i));
35383
35391
  }
35384
35392
  }
35385
35393
  removeDuplicateVertices(distance2 = 1e-4) {
@@ -35389,9 +35397,6 @@ class FileMesh {
35389
35397
  for (let i = 0; i < this.coreMesh.numverts; i++) {
35390
35398
  const pos = this.coreMesh.getPos(i);
35391
35399
  const uv = this.coreMesh.getUV(i);
35392
- if (this.skinning.subsets.length > 0) {
35393
- vertToSubset[i] = this.skinning.getSubsetIndex(i);
35394
- }
35395
35400
  const hash = hashVec3(pos[0], pos[1], pos[2], distance2) + hashVec2(uv[0], uv[1]);
35396
35401
  const existing = posToIndex.get(hash);
35397
35402
  if (existing !== void 0) {
@@ -35419,10 +35424,7 @@ class FileMesh {
35419
35424
  newIndex.set(canonical, newVerts.length);
35420
35425
  newVerts.push(canonical);
35421
35426
  newSubsetIndices.push(vertToSubset[i]);
35422
- const skinning = this.skinning.skinnings[canonical];
35423
- if (skinning) {
35424
- newSkinnings.push(skinning);
35425
- }
35427
+ newSkinnings.push(canonical);
35426
35428
  }
35427
35429
  remap[i] = newIndex.get(canonical);
35428
35430
  }
@@ -35430,22 +35432,8 @@ class FileMesh {
35430
35432
  const remapFace = this.coreMesh.getFace(remap[i]);
35431
35433
  this.coreMesh.setFace(i, clonePrimitiveArray(remapFace));
35432
35434
  }
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
35435
  this.coreMesh.onlyVerts(newVerts);
35448
- this.skinning.skinnings = newSkinnings;
35436
+ this.skinning.onlySkinnings(newSkinnings);
35449
35437
  return newVerts.length;
35450
35438
  }
35451
35439
  /*removeFace(index: number) {
@@ -35462,29 +35450,15 @@ class FileMesh {
35462
35450
  }
35463
35451
  basicSkin(boneNames) {
35464
35452
  this.skinning = new SKINNING();
35465
- this.skinning.skinnings = new Array(this.coreMesh.numverts);
35453
+ this.skinning.numskinnings = this.coreMesh.numverts;
35466
35454
  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
35455
  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;
35456
+ this.skinning.setIndex(i, [boneNames.length - 1, 0, 0, 0]);
35457
+ this.skinning.setWeight(i, [255, 0, 0, 0]);
35485
35458
  }
35486
35459
  for (let i = 0; i < boneNames.length; i++) {
35487
35460
  const bone = new FileMeshBone();
35461
+ bone.name = boneNames[i];
35488
35462
  bone.parentIndex = i - 1;
35489
35463
  if (bone.parentIndex < 0) {
35490
35464
  bone.parentIndex = 65535;
@@ -35496,15 +35470,6 @@ class FileMesh {
35496
35470
  }
35497
35471
  }
35498
35472
  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
35473
  return void 0;
35509
35474
  }
35510
35475
  }
@@ -35657,7 +35622,7 @@ async function RBLXPost(url, auth, body, attempt = 0, method = "POST") {
35657
35622
  "X-CSRF-TOKEN": xCsrfToken
35658
35623
  });
35659
35624
  try {
35660
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35625
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35661
35626
  method,
35662
35627
  credentials: FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE,
35663
35628
  headers: fetchHeaders,
@@ -35707,7 +35672,7 @@ async function RBLXGet(url, headers, includeCredentials = true, attempt = 0) {
35707
35672
  }
35708
35673
  const fetchHeaders = new Headers(newHeaders);
35709
35674
  try {
35710
- fetch(FLAGS.API_REQUEST_PREFIX + url, {
35675
+ (FLAGS.FETCH_FUNC || fetch)(FLAGS.API_REQUEST_PREFIX + url, {
35711
35676
  credentials: includeCredentials ? FLAGS.INCLUDE_REQUEST_CREDENTIALS_OVERRIDE : void 0,
35712
35677
  headers: fetchHeaders,
35713
35678
  priority: FLAGS.ASSET_REQUEST_PRIORITY
@@ -36282,6 +36247,13 @@ const API = {
36282
36247
  return promise;
36283
36248
  }
36284
36249
  },
36250
+ /**
36251
+ * Remember to call .Destroy() on the Instance returned by RBX.generateTree() to avoid memory leaks
36252
+ * @param url
36253
+ * @param headers
36254
+ * @param contentRepresentationPriorityList
36255
+ * @returns
36256
+ */
36285
36257
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36286
36258
  GetRBX: async function(url, headers, contentRepresentationPriorityList) {
36287
36259
  const fetchStr = url;
@@ -36359,6 +36331,7 @@ const API = {
36359
36331
  }
36360
36332
  }
36361
36333
  CACHE.IsLayered.set(id, hasWrapLayer);
36334
+ dataModel.Destroy();
36362
36335
  return hasWrapLayer;
36363
36336
  } else {
36364
36337
  warn(true, "Failed to get accessory");
@@ -36463,6 +36436,18 @@ const API = {
36463
36436
  }
36464
36437
  //https://apis.roblox.com/marketplace-widgets/v1/pills
36465
36438
  },
36439
+ "Develop": {
36440
+ GetLatestVersions: async function(auth, assetIds) {
36441
+ const response = await RBLXPost("https://develop.roblox.com/v1/assets/latest-versions", auth, {
36442
+ assetIds,
36443
+ versionStatus: "Any"
36444
+ });
36445
+ if (response.status !== 200) {
36446
+ return response;
36447
+ }
36448
+ return await response.json();
36449
+ }
36450
+ },
36466
36451
  "Inventory": {
36467
36452
  GetInventory: async function(userId, assetType, cursor) {
36468
36453
  let requestUrl = `https://inventory.roblox.com/v2/users/${userId}/inventory/${assetType}?sortOrder=Desc&limit=100`;
@@ -41204,6 +41189,210 @@ class RenderDesc extends DisposableDesc {
41204
41189
  return this.constructor;
41205
41190
  }
41206
41191
  }
41192
+ function getPartAssemblyScore(part) {
41193
+ let score = 0;
41194
+ if (part.PropOrDefault("Name", "Part") === "HumanoidRootPart") {
41195
+ score += 1e6;
41196
+ }
41197
+ if (part.PropOrDefault("Anchored", false)) {
41198
+ score += 1e5;
41199
+ }
41200
+ if (part.PropOrDefault("Massless", false)) {
41201
+ score += 1e4;
41202
+ }
41203
+ const size = part.PropOrDefault("size", new Vector32(0, 0, 0));
41204
+ score += size.X * size.Y * size.Z;
41205
+ return score;
41206
+ }
41207
+ function getPartsInAssembly_Generate(part) {
41208
+ const inAssembly = [];
41209
+ let toCheck = [part];
41210
+ while (toCheck.length > 0) {
41211
+ const newToCheck = [];
41212
+ for (const part2 of toCheck) {
41213
+ const connected = part2.w.GetConnectedParts();
41214
+ for (const connect of connected) {
41215
+ if (!inAssembly.includes(connect)) {
41216
+ inAssembly.push(connect);
41217
+ newToCheck.push(connect);
41218
+ }
41219
+ }
41220
+ }
41221
+ toCheck = newToCheck;
41222
+ }
41223
+ return inAssembly;
41224
+ }
41225
+ function getRootAssemblyPart_Generate(part) {
41226
+ const parts = getPartsInAssembly_Generate(part);
41227
+ let highestScore = -1;
41228
+ let highestPart = part;
41229
+ for (const part2 of parts) {
41230
+ const score = getPartAssemblyScore(part2);
41231
+ if (score > highestScore) {
41232
+ highestScore = score;
41233
+ highestPart = part2;
41234
+ }
41235
+ }
41236
+ return highestPart;
41237
+ }
41238
+ class AssemblyNode {
41239
+ depth;
41240
+ nodes = [];
41241
+ part;
41242
+ children = [];
41243
+ connectors = [];
41244
+ parent;
41245
+ assembly;
41246
+ traversedRestCFrame = new CFrame();
41247
+ traversedTransformCFrame = new CFrame();
41248
+ constructor(assembly, parent, depth, part, already = []) {
41249
+ this.assembly = assembly;
41250
+ this.parent = parent;
41251
+ this.depth = depth;
41252
+ this.part = part;
41253
+ if (part.IsA("BasePart")) {
41254
+ const w = part.w;
41255
+ w.data.assemblyNode = this;
41256
+ }
41257
+ const connected = part.w.GetConnectedParts();
41258
+ for (const connect of connected) {
41259
+ if (!already.includes(connect)) {
41260
+ this.children.push(connect);
41261
+ }
41262
+ }
41263
+ const jointConnectors = part.w.GetConnectors();
41264
+ this.connectors = jointConnectors;
41265
+ }
41266
+ getNodeChildren() {
41267
+ return this.nodes;
41268
+ }
41269
+ getNodeDescendants() {
41270
+ let descendants = [...this.getNodeChildren()];
41271
+ for (const child of this.getNodeChildren()) {
41272
+ descendants = descendants.concat(child.getNodeDescendants());
41273
+ }
41274
+ return descendants;
41275
+ }
41276
+ getParentConnector() {
41277
+ if (this.parent instanceof Assembly) return;
41278
+ for (const connector of this.connectors) {
41279
+ if (this.parent.connectors.includes(connector)) {
41280
+ return connector;
41281
+ }
41282
+ }
41283
+ }
41284
+ getConnectorOffset(includeTransform) {
41285
+ const parentConnector = this.getParentConnector();
41286
+ if (!parentConnector) return new CFrame();
41287
+ if (parentConnector.Prop("Part0") === this.part) {
41288
+ return parentConnector.Prop("C0");
41289
+ } else if (parentConnector.Prop("Part1") === this.part) {
41290
+ const transform = includeTransform ? parentConnector.PropOrDefault("Transform", new CFrame()) : new CFrame();
41291
+ return parentConnector.Prop("C1").multiply(transform).inverse();
41292
+ }
41293
+ return new CFrame();
41294
+ }
41295
+ _traverseTree(transform, rest) {
41296
+ const parentConnector = this.getParentConnector();
41297
+ if (parentConnector) {
41298
+ const w = parentConnector.w;
41299
+ transform = transform.multiply(w.getAssemblyOffset(true));
41300
+ rest = rest.multiply(w.getAssemblyOffset(false));
41301
+ }
41302
+ this.traversedTransformCFrame = transform.clone();
41303
+ this.traversedRestCFrame = rest.clone();
41304
+ this.part.setProperty("CFrame", this.assembly.traverseCFrame(this, true, true));
41305
+ for (const node of this.nodes) {
41306
+ node._traverseTree(transform, rest);
41307
+ }
41308
+ }
41309
+ /**
41310
+ * Should only be called when destroying entire assembly by calling Assembly.destroy()
41311
+ */
41312
+ destroy() {
41313
+ if (this.part.IsA("BasePart")) {
41314
+ const w = this.part.w;
41315
+ w.data.assemblyNode = void 0;
41316
+ }
41317
+ }
41318
+ }
41319
+ let lastAssemblyId = 0;
41320
+ class Assembly {
41321
+ id = lastAssemblyId++;
41322
+ rootNode;
41323
+ allNodes;
41324
+ allConnectors;
41325
+ constructor(rootPart) {
41326
+ const checked = [rootPart];
41327
+ let depth = 0;
41328
+ this.rootNode = new AssemblyNode(this, this, 0, rootPart, checked);
41329
+ let toCheckNodes = [this.rootNode];
41330
+ while (toCheckNodes.length > 0) {
41331
+ depth += 1;
41332
+ const newToCheckNodes = [];
41333
+ for (const toCheck of toCheckNodes) {
41334
+ for (const child of toCheck.children) {
41335
+ const childNode = new AssemblyNode(this, toCheck, depth, child, checked);
41336
+ checked.push(child);
41337
+ newToCheckNodes.push(childNode);
41338
+ toCheck.nodes.push(childNode);
41339
+ }
41340
+ }
41341
+ toCheckNodes = newToCheckNodes;
41342
+ }
41343
+ this.traverseTree();
41344
+ }
41345
+ getNodeDescendants() {
41346
+ if (!this.allNodes) {
41347
+ this.allNodes = [this.rootNode, ...this.rootNode.getNodeDescendants()];
41348
+ }
41349
+ return this.allNodes;
41350
+ }
41351
+ getPartDescendants() {
41352
+ return this.getNodeDescendants().map((v) => {
41353
+ return v.part;
41354
+ });
41355
+ }
41356
+ getAllConnectors() {
41357
+ if (!this.allConnectors) {
41358
+ this.allConnectors = [];
41359
+ for (const node of this.getNodeDescendants()) {
41360
+ this.allConnectors.push(...node.connectors);
41361
+ }
41362
+ }
41363
+ return this.allConnectors;
41364
+ }
41365
+ getNode(name) {
41366
+ for (const node of this.getNodeDescendants()) {
41367
+ if (node.part.Prop("Name") === name) {
41368
+ return node;
41369
+ }
41370
+ }
41371
+ }
41372
+ getPart(name) {
41373
+ return this.getNode(name)?.part;
41374
+ }
41375
+ traverseTree() {
41376
+ this.rootNode._traverseTree(new CFrame(), new CFrame());
41377
+ }
41378
+ traverseCFrame(node, includeTransform, applyRoot = false) {
41379
+ const traversedCF = includeTransform ? node.traversedTransformCFrame : node.traversedRestCFrame;
41380
+ let finalCF = traversedCF.clone();
41381
+ if (applyRoot) {
41382
+ finalCF = this.rootNode.part.Prop("CFrame").multiply(finalCF);
41383
+ }
41384
+ return finalCF;
41385
+ }
41386
+ traverseInstance(node) {
41387
+ return traverseRigInstance(node.part);
41388
+ }
41389
+ destroy() {
41390
+ const descendants = this.getNodeDescendants();
41391
+ for (const descendant of descendants) {
41392
+ descendant.destroy();
41393
+ }
41394
+ }
41395
+ }
41207
41396
  class AccessoryWrapper extends InstanceWrapper {
41208
41397
  static className = "Accessory";
41209
41398
  static requiredProperties = [
@@ -41267,18 +41456,31 @@ const __vite_glob_0_0$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
41267
41456
  __proto__: null,
41268
41457
  AccessoryWrapper
41269
41458
  }, Symbol.toStringTag, { value: "Module" }));
41270
- class AnimationConstraintWrapper extends InstanceWrapper {
41271
- static className = "AnimationConstraint";
41459
+ class ConstraintWrapper extends InstanceWrapper {
41460
+ static className = "Constraint";
41272
41461
  static requiredProperties = [
41273
41462
  "Name",
41274
41463
  "Attachment0",
41275
- "Attachment1",
41276
- "Transform"
41464
+ "Attachment1"
41277
41465
  ];
41278
41466
  setup() {
41279
41467
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
41280
41468
  if (!this.instance.HasProperty("Attachment0")) this.instance.addProperty(new Property("Attachment0", DataType.Referent), void 0);
41281
41469
  if (!this.instance.HasProperty("Attachment1")) this.instance.addProperty(new Property("Attachment1", DataType.Referent), void 0);
41470
+ }
41471
+ }
41472
+ const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41473
+ __proto__: null,
41474
+ ConstraintWrapper
41475
+ }, Symbol.toStringTag, { value: "Module" }));
41476
+ class AnimationConstraintWrapper extends ConstraintWrapper {
41477
+ static className = "AnimationConstraint";
41478
+ static requiredProperties = [
41479
+ ...super.requiredProperties,
41480
+ "Transform"
41481
+ ];
41482
+ setup() {
41483
+ super.setup();
41282
41484
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
41283
41485
  }
41284
41486
  }
@@ -42141,7 +42343,7 @@ function calculateMotor6Doffset(motor, includeTransform = false) {
42141
42343
  const finalCF = C0.multiply(offset1);
42142
42344
  return finalCF;
42143
42345
  }
42144
- function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42346
+ function traverseRigCFrameNoAssembly(instance, includeTransform = false, applyRoot = false) {
42145
42347
  const motors = [];
42146
42348
  let lastInstance = instance;
42147
42349
  let lastMotor6D = void 0;
@@ -42221,6 +42423,35 @@ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false
42221
42423
  }
42222
42424
  return finalCF;
42223
42425
  }
42426
+ function traverseRigCFrameAssembly(instance, includeTransform = false, applyRoot = false) {
42427
+ const motors = [];
42428
+ let assemblyNode = instance.w.GetAssemblyNode();
42429
+ while (!(assemblyNode.parent instanceof Assembly)) {
42430
+ for (const connector of assemblyNode.connectors) {
42431
+ if (assemblyNode.parent.connectors.includes(connector)) {
42432
+ motors.push(connector);
42433
+ break;
42434
+ }
42435
+ }
42436
+ assemblyNode = assemblyNode.parent;
42437
+ }
42438
+ motors.reverse();
42439
+ let finalCF = new CFrame();
42440
+ for (const motor of motors) {
42441
+ finalCF = finalCF.multiply(calculateMotor6Doffset(motor, includeTransform));
42442
+ }
42443
+ if (applyRoot) {
42444
+ finalCF = assemblyNode.assembly.rootNode.part.Prop("CFrame").multiply(finalCF);
42445
+ }
42446
+ return finalCF;
42447
+ }
42448
+ function traverseRigCFrame(instance, includeTransform = false, applyRoot = false) {
42449
+ if (FLAGS.USE_ASSEMBLY) {
42450
+ return traverseRigCFrameAssembly(instance, includeTransform, applyRoot);
42451
+ } else {
42452
+ return traverseRigCFrameNoAssembly(instance, includeTransform, applyRoot);
42453
+ }
42454
+ }
42224
42455
  function traverseRigInstanceOld(instance) {
42225
42456
  const children = [];
42226
42457
  let lastMotor6D = instance.FindFirstChildOfClass("Motor6D");
@@ -42238,7 +42469,7 @@ function traverseRigInstanceOld(instance) {
42238
42469
  children.reverse();
42239
42470
  return children;
42240
42471
  }
42241
- function traverseRigInstance(instance) {
42472
+ function traverseRigInstanceNoAssembly(instance) {
42242
42473
  const children = [];
42243
42474
  let lastMotor6D = void 0;
42244
42475
  if (instance.className === "Motor6D" || instance.className === "Weld") {
@@ -42304,6 +42535,23 @@ function traverseRigInstance(instance) {
42304
42535
  children.reverse();
42305
42536
  return children;
42306
42537
  }
42538
+ function traverseRigInstanceAssembly(instance) {
42539
+ const children = [];
42540
+ let assemblyNode = instance.w.GetAssemblyNode();
42541
+ while (!(assemblyNode.parent instanceof Assembly)) {
42542
+ children.push(assemblyNode.part);
42543
+ assemblyNode = assemblyNode.parent;
42544
+ }
42545
+ children.reverse();
42546
+ return children;
42547
+ }
42548
+ function traverseRigInstance(instance) {
42549
+ if (FLAGS.USE_ASSEMBLY) {
42550
+ return traverseRigInstanceAssembly(instance);
42551
+ } else {
42552
+ return traverseRigInstanceNoAssembly(instance);
42553
+ }
42554
+ }
42307
42555
  const modelLayers = /* @__PURE__ */ new Map();
42308
42556
  function arrIsSameVector3(arr0, arr1) {
42309
42557
  if (arr0.length !== arr1.length) {
@@ -42506,6 +42754,12 @@ class ModelLayersDesc {
42506
42754
  }
42507
42755
  return true;
42508
42756
  }
42757
+ getTargetName(i) {
42758
+ if (!this.targetParents) throw new Error("this.targetParents is missing");
42759
+ const targetParents = this.targetParents[i];
42760
+ const targetName = targetParents[targetParents.length - 1];
42761
+ return targetName;
42762
+ }
42509
42763
  fromModel(model) {
42510
42764
  this.targetMeshes = [];
42511
42765
  this.targetCages = [];
@@ -42607,12 +42861,14 @@ class ModelLayersDesc {
42607
42861
  }
42608
42862
  for (let i = 0; i < this.targetMeshes.length; i++) {
42609
42863
  const targetMesh = meshMap.get(this.targetMeshes[i]);
42610
- if (targetMesh.skinning.skinnings.length < 1) {
42864
+ if (targetMesh.skinning.numskinnings < 1) {
42611
42865
  targetMesh.basicSkin(this.targetParents[i]);
42612
42866
  }
42613
42867
  const targetCage = meshMap.get(this.targetCages[i]);
42614
42868
  targetCage.removeDuplicateVertices();
42615
42869
  inheritSkeleton(targetCage, targetMesh);
42870
+ targetCage.setBoneSource(this.getTargetName(i));
42871
+ targetCage.setBoneSourceSize();
42616
42872
  }
42617
42873
  const distDeformer = this.targetDeformers[0];
42618
42874
  const dist_mesh = distDeformer ? meshMap.get(distDeformer.targetCage).clone() : meshMap.get(this.targetCages[0]).clone();
@@ -43047,32 +43303,25 @@ function fileMeshToTHREEGeometry(mesh, canIncludeSkinning = true, forceVertexCol
43047
43303
  const toUseIndices = mesh.coreMesh.getIndices().subarray(facesStart * 3, facesEnd * 3);
43048
43304
  geometry.setIndex(new BufferAttribute(toUseIndices, 1));
43049
43305
  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
- }
43306
+ if (meshSkinning && meshSkinning.numskinnings > 0 && canIncludeSkinning) {
43307
+ const skinIndices = meshSkinning.indices.slice();
43308
+ const skinWeights = meshSkinning.weights.slice();
43309
+ const hasRootBone = meshSkinning.getBone("Root") !== void 0 || meshSkinning.getBone("root") !== void 0;
43310
+ for (let i = 0; i < meshSkinning.numskinnings; i++) {
43311
+ const boneWeights = meshSkinning.getWeight(i);
43312
+ const boneIndices = meshSkinning.getIndex(i);
43313
+ skinWeights[i * 4 + 0] = boneWeights[0] / 255;
43314
+ skinWeights[i * 4 + 1] = boneWeights[1] / 255;
43315
+ skinWeights[i * 4 + 2] = boneWeights[2] / 255;
43316
+ skinWeights[i * 4 + 3] = boneWeights[3] / 255;
43317
+ const index0 = boneIndices[0];
43318
+ const index1 = boneIndices[1];
43319
+ const index2 = boneIndices[2];
43320
+ const index3 = boneIndices[3];
43321
+ skinIndices[i * 4 + 0] = !hasRootBone && index0 > 0 ? index0 + 1 : index0;
43322
+ skinIndices[i * 4 + 1] = !hasRootBone && index1 > 0 ? index1 + 1 : index1;
43323
+ skinIndices[i * 4 + 2] = !hasRootBone && index2 > 0 ? index2 + 1 : index2;
43324
+ skinIndices[i * 4 + 3] = !hasRootBone && index3 > 0 ? index3 + 1 : index3;
43076
43325
  }
43077
43326
  geometry.setAttribute("skinIndex", new Uint16BufferAttribute(skinIndices, 4));
43078
43327
  geometry.setAttribute("skinWeight", new Float32BufferAttribute(skinWeights, 4));
@@ -43113,6 +43362,7 @@ class MeshDesc {
43113
43362
  instance;
43114
43363
  fileMesh;
43115
43364
  wasAutoSkinned = false;
43365
+ wasDeformed = false;
43116
43366
  dispose() {
43117
43367
  this.instance = void 0;
43118
43368
  }
@@ -43291,14 +43541,13 @@ class MeshDesc {
43291
43541
  }
43292
43542
  if (FLAGS.SHOW_CAGE) {
43293
43543
  the_ref_mesh = dist_mesh;
43294
- the_ref_mesh.skinning.skinnings = [];
43544
+ the_ref_mesh.skinning.numskinnings = 0;
43295
43545
  the_ref_mesh.skinning.bones = [];
43296
- the_ref_mesh.skinning.subsets = [];
43297
43546
  }
43298
43547
  const layeredClothingCacheId = `${this.mesh}-${this.layerDesc.reference}`;
43299
43548
  switch (FLAGS.LAYERED_CLOTHING_ALGORITHM) {
43300
43549
  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;
43550
+ const shouldAutoSkin = this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledOverride || this.layerDesc.autoSkin === WrapLayerAutoSkin.EnabledPreserve && mesh.skinning.numskinnings < 1 || mesh.skinning.numskinnings <= 0;
43302
43551
  if (FLAGS.AUTO_SKIN_EVERYTHING || shouldAutoSkin) {
43303
43552
  this.wasAutoSkinned = true;
43304
43553
  const transferTo = ref_mesh.clone();
@@ -43310,6 +43559,7 @@ class MeshDesc {
43310
43559
  noDeformation = true;
43311
43560
  }
43312
43561
  rbfDeformer.affectBones = FLAGS.USE_LOCAL_SKELETONDESC;
43562
+ this.wasDeformed = true;
43313
43563
  await rbfDeformer.solveAsync();
43314
43564
  rbfDeformer.deformMesh();
43315
43565
  break;
@@ -43442,7 +43692,7 @@ class MeshDesc {
43442
43692
  let mesh = void 0;
43443
43693
  mesh = await this.getMesh();
43444
43694
  if (mesh instanceof Response) return mesh;
43445
- if (!mesh.facs && this.headMesh && mesh.skinning.skinnings.length > 0) {
43695
+ if (!mesh.facs && this.headMesh && mesh.skinning.numskinnings > 0) {
43446
43696
  const headMesh = await API.Asset.GetMesh(this.headMesh, void 0, true);
43447
43697
  if (headMesh instanceof Response) {
43448
43698
  warn(true, "Failed to get headMesh for compileMesh", headMesh);
@@ -43554,26 +43804,6 @@ class MeshDesc {
43554
43804
  const meshIdStr = child.Property("MeshId");
43555
43805
  this.mesh = meshIdStr;
43556
43806
  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
43807
  const surfaceAppearance = child.FindLastChildOfClass("SurfaceAppearance");
43578
43808
  if (surfaceAppearance) {
43579
43809
  const color = surfaceAppearance.HasProperty("Color") ? surfaceAppearance.Prop("Color") : new Color3(1, 1, 1);
@@ -44933,6 +45163,84 @@ class MaterialDesc {
44933
45163
  }
44934
45164
  }
44935
45165
  }
45166
+ class BasePartWrapperData {
45167
+ assemblyNode;
45168
+ }
45169
+ class BasePartWrapper extends InstanceWrapper {
45170
+ static className = "BasePart";
45171
+ static requiredProperties = [
45172
+ "Name",
45173
+ "CFrame",
45174
+ "size",
45175
+ "Transparency",
45176
+ "_data"
45177
+ ];
45178
+ setup() {
45179
+ if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
45180
+ if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
45181
+ if (!this.instance.HasProperty("size")) this.instance.addProperty(new Property("size", DataType.Vector3), new Vector32());
45182
+ if (!this.instance.HasProperty("Transparency")) this.instance.addProperty(new Property("Transparency", DataType.Float32), 0);
45183
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new BasePartWrapperData());
45184
+ }
45185
+ get data() {
45186
+ return this.instance.Prop("_data");
45187
+ }
45188
+ created() {
45189
+ const destroyAssembly = () => {
45190
+ if (this.data.assemblyNode) {
45191
+ this.data.assemblyNode.assembly.destroy();
45192
+ }
45193
+ };
45194
+ this.instance.referencedByChanged.Connect(destroyAssembly);
45195
+ this.instance.AncestryChanged.Connect(destroyAssembly);
45196
+ this.instance.ChildRemoved.Connect(destroyAssembly);
45197
+ this.instance.Destroying.Connect(destroyAssembly);
45198
+ }
45199
+ preRender() {
45200
+ if (FLAGS.USE_ASSEMBLY) {
45201
+ const assemblyNode = this.GetAssemblyNode();
45202
+ if (assemblyNode.depth === 0) {
45203
+ assemblyNode.assembly.traverseTree();
45204
+ }
45205
+ }
45206
+ }
45207
+ GetAssemblyNode() {
45208
+ if (this.data.assemblyNode) return this.data.assemblyNode;
45209
+ const rootPart = getRootAssemblyPart_Generate(this.instance);
45210
+ new Assembly(rootPart);
45211
+ return this.data.assemblyNode;
45212
+ }
45213
+ GetAssembly() {
45214
+ return this.GetAssemblyNode().assembly;
45215
+ }
45216
+ GetConnectors() {
45217
+ const connectors = [];
45218
+ const references = this.instance.getReferencedBy();
45219
+ for (const reference of references) {
45220
+ if (reference.IsA("JointInstance")) {
45221
+ connectors.push(reference);
45222
+ }
45223
+ }
45224
+ return connectors;
45225
+ }
45226
+ GetConnectedParts() {
45227
+ const connected = [];
45228
+ const references = this.instance.getReferencedBy();
45229
+ for (const reference of references) {
45230
+ if (reference.IsA("JointInstance")) {
45231
+ const part0 = reference.Prop("Part0");
45232
+ const part1 = reference.Prop("Part1");
45233
+ if (part0 && part0 !== this.instance && part0.IsA("BasePart")) connected.push(part0);
45234
+ if (part1 && part1 !== this.instance && part1.IsA("BasePart")) connected.push(part1);
45235
+ }
45236
+ }
45237
+ return connected;
45238
+ }
45239
+ }
45240
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45241
+ __proto__: null,
45242
+ BasePartWrapper
45243
+ }, Symbol.toStringTag, { value: "Module" }));
44936
45244
  class FaceControlsWrapper extends InstanceWrapper {
44937
45245
  static className = "FaceControls";
44938
45246
  static requiredProperties = ["Name", ...FaceControlNames];
@@ -44945,27 +45253,12 @@ class FaceControlsWrapper extends InstanceWrapper {
44945
45253
  }
44946
45254
  }
44947
45255
  }
44948
- const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45256
+ const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44949
45257
  __proto__: null,
44950
45258
  FaceControlsWrapper
44951
45259
  }, 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();
45260
+ function diffCFrame(parent, child) {
45261
+ return parent.inverse().multiply(child);
44969
45262
  }
44970
45263
  function boneIsChildOf(bone, parentName) {
44971
45264
  let nextParent = bone.parent;
@@ -44977,73 +45270,16 @@ function boneIsChildOf(bone, parentName) {
44977
45270
  }
44978
45271
  return false;
44979
45272
  }
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 {
45273
+ class SkeletonDesc {
45038
45274
  renderableDesc;
45039
45275
  meshDesc;
45040
45276
  skeleton;
45041
45277
  rootBone;
45042
45278
  bones;
45043
45279
  originalBoneCFrames = [];
45044
- originalHeadCFrame = new CFrame();
45045
- originalDynamicHeadCFrame = new CFrame();
45280
+ boneSourceParts = [];
45046
45281
  skeletonHelper;
45282
+ frameCount = 0;
45047
45283
  constructor(renderableDesc, meshDesc, scene) {
45048
45284
  this.renderableDesc = renderableDesc;
45049
45285
  this.meshDesc = meshDesc;
@@ -45055,9 +45291,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45055
45291
  const boneArr = [];
45056
45292
  for (let i = 0; i < skinning.bones.length; i++) {
45057
45293
  const threeBone = new Bone();
45058
- threeBone.name = skinning.nameTable[i];
45059
- if (threeBone.name === "HumanoidRootPart") {
45060
- threeBone.name = "HumanoidRootNode";
45294
+ threeBone.name = skinning.bones[i].name || "";
45295
+ if (threeBone.name === "HumanoidRootNode") {
45296
+ threeBone.name = "HumanoidRootPart";
45061
45297
  }
45062
45298
  if (threeBone.name === "root") {
45063
45299
  threeBone.name = "Root";
@@ -45066,6 +45302,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45066
45302
  }
45067
45303
  this.bones = boneArr;
45068
45304
  log(false, skinning);
45305
+ log(false, this);
45069
45306
  let rootBone = void 0;
45070
45307
  for (let i = 0; i < skinning.bones.length; i++) {
45071
45308
  const bone = skinning.bones[i];
@@ -45078,18 +45315,15 @@ let SkeletonDesc$1 = class SkeletonDesc {
45078
45315
  const worldBoneCF = new CFrame(...bone.position);
45079
45316
  worldBoneCF.fromRotationMatrix(...bone.rotationMatrix);
45080
45317
  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
- }
45318
+ this.boneSourceParts.push(bone.sourcePart);
45319
+ this.originalBoneCFrames.push(worldBoneCF);
45087
45320
  setTHREEObjectCF(threeBone, boneCF);
45088
45321
  parentThreeBone.add(threeBone);
45089
45322
  } else {
45090
45323
  rootBone = threeBone;
45091
45324
  const boneCF = new CFrame(...bone.position);
45092
45325
  boneCF.fromRotationMatrix(...bone.rotationMatrix);
45326
+ this.boneSourceParts.push(bone.sourcePart);
45093
45327
  this.originalBoneCFrames.push(boneCF);
45094
45328
  setTHREEObjectCF(threeBone, boneCF);
45095
45329
  }
@@ -45103,6 +45337,7 @@ let SkeletonDesc$1 = class SkeletonDesc {
45103
45337
  trueRootBone.name = "Root";
45104
45338
  trueRootBone.position.set(0, 0, 0);
45105
45339
  trueRootBone.rotation.set(0, 0, 0, "YXZ");
45340
+ this.boneSourceParts.unshift(void 0);
45106
45341
  this.originalBoneCFrames.unshift(new CFrame());
45107
45342
  this.bones.unshift(trueRootBone);
45108
45343
  trueRootBone.add(rootBone);
@@ -45110,23 +45345,9 @@ let SkeletonDesc$1 = class SkeletonDesc {
45110
45345
  }
45111
45346
  this.rootBone = rootBone;
45112
45347
  }
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
45348
  this.skeleton = new Skeleton(boneArr);
45128
45349
  this.setAsRest();
45129
- if (FLAGS.SHOW_SKELETON_HELPER) {
45350
+ if (FLAGS.SHOW_SKELETON_HELPER && (FLAGS.SKELETON_HELPER_INSTANCE_NAME === void 0 || FLAGS.SKELETON_HELPER_INSTANCE_NAME === meshDesc.instance?.name)) {
45130
45351
  const skeletonHelper = new SkeletonHelper(this.rootBone);
45131
45352
  scene.add(skeletonHelper);
45132
45353
  this.skeletonHelper = skeletonHelper;
@@ -45139,39 +45360,6 @@ let SkeletonDesc$1 = class SkeletonDesc {
45139
45360
  this.skeleton.boneInverses[boneIndex].copy(bone.matrixWorld).invert();
45140
45361
  }
45141
45362
  }
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
45363
  getBoneWithName(name) {
45176
45364
  for (const bone of this.bones) {
45177
45365
  if (bone.name === name) {
@@ -45190,377 +45378,160 @@ let SkeletonDesc$1 = class SkeletonDesc {
45190
45378
  return rig;
45191
45379
  }
45192
45380
  }
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;
45381
+ getScale(node) {
45382
+ if (this.meshDesc.wasAutoSkinned) return new Vector32(1, 1, 1);
45383
+ const partSize = node.part.Prop("Size");
45384
+ const meshSize = node.part.PropOrDefault("InitialSize", new Vector32(...this.meshDesc.fileMesh.size));
45385
+ const scale = partSize.divide(meshSize);
45386
+ return scale;
45200
45387
  }
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();
45388
+ getOriginalWorldCFrameNoChange(bone) {
45389
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45390
+ return ogCF;
45217
45391
  }
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
- }
45392
+ getOriginalWorldCFrame(bone, node) {
45393
+ if (this.meshDesc.wasAutoSkinned) {
45394
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45395
+ const nodeWorldCF = node.assembly.traverseCFrame(node, false, false);
45396
+ return nodeWorldCF.inverse().multiply(ogCF);
45397
+ } else {
45398
+ const scale = this.getScale(node);
45399
+ const ogCF = this.originalBoneCFrames[this.bones.indexOf(bone)].clone();
45400
+ ogCF.Position = multiply(ogCF.Position, scale.toVec3());
45401
+ return ogCF;
45402
+ }
45403
+ }
45404
+ getSourcePart(bone) {
45405
+ return this.boneSourceParts[this.bones.indexOf(bone)];
45406
+ }
45407
+ getSourceNode(selfNode, bone, assembly) {
45408
+ const sourceName = this.getSourcePart(bone);
45409
+ const potentialSourceNode = sourceName ? assembly.getNode(sourceName) : selfNode;
45410
+ const sourceNode = potentialSourceNode ? potentialSourceNode : selfNode;
45411
+ return sourceNode;
45412
+ }
45413
+ getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform) {
45414
+ const node = assembly.getNode(bone.name);
45415
+ const selfNode = selfInstance.w.GetAssemblyNode();
45416
+ const sourceNode = this.getSourceNode(selfNode, bone, assembly);
45417
+ if (bone.name === "Root") {
45418
+ return assembly.traverseCFrame(selfNode, includeTransform, true);
45419
+ } else if (node) {
45420
+ if (this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned && bone.name === "Head") {
45421
+ const ogCF = assembly.traverseCFrame(node, includeTransform, true);
45422
+ const connectorOffset = node.getConnectorOffset(includeTransform).inverse();
45423
+ connectorOffset.Orientation = [0, 0, 0];
45424
+ return ogCF.multiply(connectorOffset);
45425
+ } else {
45426
+ return assembly.traverseCFrame(node, includeTransform, true);
45303
45427
  }
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);
45428
+ } else {
45429
+ const result = assembly.traverseCFrame(sourceNode, includeTransform, true).multiply(this.getOriginalWorldCFrame(bone, sourceNode));
45430
+ return result;
45314
45431
  }
45315
45432
  }
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;
45433
+ isFACS(boneName) {
45434
+ return this.meshDesc.fileMesh?.facs?.faceBoneNames.includes(boneName);
45435
+ }
45436
+ addFACS(restCF, bone, assembly) {
45437
+ const isFACS = this.isFACS(bone.name);
45438
+ if (!isFACS) return restCF;
45439
+ const facsMesh = this.meshDesc.fileMesh;
45440
+ const facs = this.meshDesc.fileMesh?.facs;
45441
+ const headNode = assembly.getNode("Head");
45442
+ if (headNode && facsMesh && facs && facs.quantizedTransforms) {
45443
+ const head = headNode.part;
45444
+ let faceControls = head.FindFirstChildOfClass("FaceControls");
45445
+ if (!faceControls) {
45446
+ faceControls = new Instance("FaceControls");
45447
+ faceControls.setParent(head);
45448
+ }
45449
+ new FaceControlsWrapper(faceControls);
45450
+ for (let j = 0; j < facs.faceBoneNames.length; j++) {
45451
+ const boneName = facs.faceBoneNames[j];
45452
+ if (boneName === bone.name) {
45453
+ let totalPosition = new Vector32();
45454
+ let totalRotation = new Vector32();
45455
+ for (let i = 0; i < facs.faceControlNames.length; i++) {
45456
+ const faceControlName = facs.faceControlNames[i];
45457
+ const col = i;
45458
+ const row = j;
45459
+ const cols = facs.faceControlNames.length;
45460
+ const index = row * cols + col;
45461
+ const posX = facs.quantizedTransforms.px.matrix[index];
45462
+ const posY = facs.quantizedTransforms.py.matrix[index];
45463
+ const posZ = facs.quantizedTransforms.pz.matrix[index];
45464
+ const rotX = facs.quantizedTransforms.rx.matrix[index];
45465
+ const rotY = facs.quantizedTransforms.ry.matrix[index];
45466
+ const rotZ = facs.quantizedTransforms.rz.matrix[index];
45467
+ const pos = new Vector32(posX, posY, posZ);
45468
+ const rot = new Vector32(rotX, rotY, rotZ);
45469
+ let weight = 0;
45470
+ if (faceControlName.includes(" ")) {
45471
+ weight = 1;
45472
+ for (const faceControlSubname of faceControlName.split(" ")) {
45473
+ const propertyName = AbbreviationToFaceControlProperty[faceControlSubname];
45474
+ weight *= faceControls.Prop(propertyName);
45397
45475
  }
45476
+ } else {
45477
+ const propertyName = AbbreviationToFaceControlProperty[faceControlName];
45478
+ if (propertyName === void 0) {
45479
+ log(false, faceControlName);
45480
+ }
45481
+ weight = faceControls.Prop(propertyName);
45398
45482
  }
45483
+ totalPosition = totalPosition.add(pos.multiply(new Vector32(weight, weight, weight)));
45484
+ totalRotation = totalRotation.add(rot.multiply(new Vector32(weight, weight, weight)));
45399
45485
  }
45486
+ const resultCF = new CFrame();
45487
+ const euler = new Euler(rad(totalRotation.X), rad(totalRotation.Y), rad(totalRotation.Z), "XYZ");
45488
+ euler.reorder("YXZ");
45489
+ resultCF.Orientation = [deg(euler.x), deg(euler.y), deg(euler.z)];
45490
+ resultCF.Position = multiply(totalPosition.toVec3(), this.getScale(headNode).toVec3());
45491
+ return restCF.multiply(resultCF);
45400
45492
  }
45401
45493
  }
45402
45494
  }
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();
45495
+ return restCF;
45549
45496
  }
45550
45497
  updateBoneMatrix(selfInstance, includeTransform = false) {
45551
45498
  if (!selfInstance.parent) return;
45552
45499
  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());
45500
+ const w = selfInstance.w;
45501
+ if (!(w instanceof BasePartWrapper)) return;
45502
+ const assembly = w.GetAssembly();
45503
+ const boneWorldCFrameArr = new Array(this.bones.length);
45555
45504
  for (let i = 0; i < this.bones.length; i++) {
45556
45505
  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)));
45506
+ const boneWorldCFrame = this.getBoneWorldCFrame(bone, assembly, selfInstance, includeTransform);
45507
+ boneWorldCFrameArr[i] = boneWorldCFrame;
45508
+ }
45509
+ for (let i = 0; i < this.bones.length; i++) {
45510
+ const bone = this.bones[i];
45511
+ const boneWorldCFrame = boneWorldCFrameArr[i];
45512
+ let parentBone = bone.parent;
45513
+ if (!(parentBone instanceof Bone)) parentBone = null;
45514
+ if (bone && parentBone) {
45515
+ if ((boneIsChildOf(bone, "DynamicHead") || bone.name === "DynamicHead") && this.meshDesc.wasDeformed && !this.meshDesc.wasAutoSkinned) {
45516
+ const parentBoneWorldCFrame = this.getOriginalWorldCFrameNoChange(parentBone);
45517
+ const boneWorldCFrameNoChange = this.getOriginalWorldCFrameNoChange(bone);
45518
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrameNoChange);
45519
+ let scale = new Vector32(1, 1, 1);
45520
+ const headNode = assembly.getNode("Head");
45521
+ if (headNode) {
45522
+ scale = this.getScale(headNode);
45523
+ }
45524
+ diffCF.Position = multiply(diffCF.Position, scale.toVec3());
45525
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45526
+ setTHREEObjectCF(bone, diffCF);
45527
+ } else {
45528
+ const parentBoneWorldCFrame = boneWorldCFrameArr[this.bones.indexOf(parentBone)];
45529
+ let diffCF = diffCFrame(parentBoneWorldCFrame, boneWorldCFrame);
45530
+ if (includeTransform) diffCF = this.addFACS(diffCF, bone, assembly);
45531
+ setTHREEObjectCF(bone, diffCF);
45532
+ }
45562
45533
  } else {
45563
- setBoneToCFrame(bone, ogBoneCF);
45534
+ setTHREEObjectCF(bone, boneWorldCFrame);
45564
45535
  }
45565
45536
  }
45566
45537
  this.updateMatrixWorld();
@@ -45576,85 +45547,12 @@ class SkeletonDesc2 {
45576
45547
  }
45577
45548
  update(instance) {
45578
45549
  if (!FLAGS.UPDATE_SKELETON || !instance.parent || !this.meshDesc.fileMesh) return;
45579
- const isHead = this.meshDesc.headMesh === this.meshDesc.mesh;
45580
45550
  this.updateBoneMatrix(instance);
45581
45551
  if (FLAGS.ANIMATE_SKELETON) {
45582
45552
  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
45553
  }
45657
45554
  this.updateMatrixWorld();
45555
+ this.frameCount += 1;
45658
45556
  }
45659
45557
  dispose(scene) {
45660
45558
  if (this.skeletonHelper) {
@@ -45673,7 +45571,7 @@ class SkeletonDesc2 {
45673
45571
  }
45674
45572
  }
45675
45573
  static descNeedsSkeleton(meshDesc) {
45676
- return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.subsets.length > 0 && meshDesc.fileMesh.skinning.skinnings.length > 0;
45574
+ return meshDesc.canHaveSkinning && meshDesc.fileMesh && meshDesc.fileMesh.skinning && meshDesc.fileMesh.skinning.numskinnings > 0;
45677
45575
  }
45678
45576
  }
45679
45577
  const PartTypes = ["Part", "WedgePart"];
@@ -45823,12 +45721,8 @@ class ObjectDesc extends RenderDesc {
45823
45721
  const oldSize = this.originalScale;
45824
45722
  threeMesh.scale.set(this.size.X / oldSize.x, this.size.Y / oldSize.y, this.size.Z / oldSize.z);
45825
45723
  }
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
- }
45724
+ if (SkeletonDesc.descNeedsSkeleton(this.meshDesc)) {
45725
+ this.skeletonDesc = new SkeletonDesc(this, this.meshDesc, scene);
45832
45726
  } else {
45833
45727
  this.meshDesc.fileMesh = void 0;
45834
45728
  }
@@ -47136,7 +47030,8 @@ class AnimatorWrapper extends InstanceWrapper {
47136
47030
  const result = await API.Asset.GetRBX(`rbxassetid://${id}`, void 0);
47137
47031
  if (result instanceof RBX) {
47138
47032
  log(false, "loading anim", id);
47139
- const animTrackInstance = result.generateTree().GetChildren()[0];
47033
+ const dataModel = result.generateTree();
47034
+ const animTrackInstance = dataModel.GetChildren()[0];
47140
47035
  if (animTrackInstance && humanoid.parent) {
47141
47036
  const animTrack = new AnimationTrack().loadAnimation(humanoid.parent, animTrackInstance);
47142
47037
  if (forceLoop) {
@@ -47147,7 +47042,10 @@ class AnimatorWrapper extends InstanceWrapper {
47147
47042
  }
47148
47043
  this.data.animationTracks.set(id, animTrack);
47149
47044
  this.instance.setProperty("_HasLoadedAnimation", true);
47045
+ dataModel.Destroy();
47150
47046
  return animTrack;
47047
+ } else {
47048
+ dataModel.Destroy();
47151
47049
  }
47152
47050
  } else {
47153
47051
  return result;
@@ -47170,7 +47068,8 @@ class AnimatorWrapper extends InstanceWrapper {
47170
47068
  if (!(animationInfo instanceof RBX)) {
47171
47069
  return animationInfo;
47172
47070
  }
47173
- const root = animationInfo.generateTree().GetChildren()[0];
47071
+ const dataModel = animationInfo.generateTree();
47072
+ const root = dataModel.GetChildren()[0];
47174
47073
  const promises = [];
47175
47074
  if (!isEmote) {
47176
47075
  for (const anim of root.GetChildren()) {
@@ -47240,6 +47139,7 @@ class AnimatorWrapper extends InstanceWrapper {
47240
47139
  }
47241
47140
  }
47242
47141
  }
47142
+ dataModel.Destroy();
47243
47143
  }
47244
47144
  /**
47245
47145
  * Switches to new animation
@@ -47305,14 +47205,16 @@ class AttachmentWrapper extends InstanceWrapper {
47305
47205
  if (!this.instance.HasProperty("Name")) this.instance.addProperty(new Property("Name", DataType.String), this.instance.className);
47306
47206
  if (!this.instance.HasProperty("CFrame")) this.instance.addProperty(new Property("CFrame", DataType.CFrame), new CFrame());
47307
47207
  }
47308
- getWorldCFrame() {
47208
+ getWorldCFrame(includeTransform = true) {
47309
47209
  if (this.instance.parent) {
47310
47210
  if (this.instance.parent.w?.IsA("BasePart")) {
47311
47211
  const parentCF = this.instance.parent.PropOrDefault("CFrame", new CFrame());
47312
- return parentCF.multiply(this.instance.Prop("CFrame"));
47212
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47213
+ return parentCF.multiply(this.instance.Prop("CFrame")).multiply(transform);
47313
47214
  } else if (this.instance.parent.w?.IsA("Attachment")) {
47314
47215
  const w = this.instance.parent.w;
47315
- return w.getWorldCFrame().multiply(this.instance.Prop("CFrame"));
47216
+ const transform = includeTransform ? this.instance.PropOrDefault("Transform", new CFrame()) : new CFrame();
47217
+ return w.getWorldCFrame().multiply(this.instance.Prop("CFrame")).multiply(transform);
47316
47218
  }
47317
47219
  }
47318
47220
  return this.instance.Prop("CFrame");
@@ -47322,25 +47224,6 @@ const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47322
47224
  __proto__: null,
47323
47225
  AttachmentWrapper
47324
47226
  }, 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
47227
  class BodyColorsWrapper extends InstanceWrapper {
47345
47228
  static className = "BodyColors";
47346
47229
  static requiredProperties = [
@@ -47420,6 +47303,21 @@ const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
47420
47303
  __proto__: null,
47421
47304
  BodyPartDescriptionWrapper
47422
47305
  }, Symbol.toStringTag, { value: "Module" }));
47306
+ class BoneWrapper extends AttachmentWrapper {
47307
+ static className = "Bone";
47308
+ static requiredProperties = [
47309
+ ...super.requiredProperties,
47310
+ "Transform"
47311
+ ];
47312
+ setup() {
47313
+ super.setup();
47314
+ if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
47315
+ }
47316
+ }
47317
+ const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47318
+ __proto__: null,
47319
+ BoneWrapper
47320
+ }, Symbol.toStringTag, { value: "Module" }));
47423
47321
  class DecalWrapper extends InstanceWrapper {
47424
47322
  static className = "Decal";
47425
47323
  static requiredProperties = [
@@ -47441,7 +47339,7 @@ class DecalWrapper extends InstanceWrapper {
47441
47339
  if (!this.instance.HasProperty("UVScale")) this.instance.addProperty(new Property("UVScale", DataType.Vector2), new Vector22());
47442
47340
  }
47443
47341
  }
47444
- const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47342
+ const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47445
47343
  __proto__: null,
47446
47344
  DecalWrapper
47447
47345
  }, Symbol.toStringTag, { value: "Module" }));
@@ -47585,7 +47483,7 @@ class MakeupDescriptionWrapper extends InstanceWrapper {
47585
47483
  if (!this.instance.HasProperty("Instance")) this.instance.addProperty(new Property("Instance", DataType.Referent), void 0);
47586
47484
  }
47587
47485
  }
47588
- const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47486
+ const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47589
47487
  __proto__: null,
47590
47488
  MakeupDescriptionWrapper
47591
47489
  }, Symbol.toStringTag, { value: "Module" }));
@@ -48285,7 +48183,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48285
48183
  moveAttachmentsToBase(child);
48286
48184
  }
48287
48185
  for (const childChild of child.GetChildren()) {
48288
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48186
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48289
48187
  childChild.Destroy();
48290
48188
  }
48291
48189
  }
@@ -48323,10 +48221,13 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48323
48221
  const head2 = dataModel.FindFirstChildOfClass("MeshPart");
48324
48222
  if (head2) {
48325
48223
  for (const childChild of head2.GetChildren()) {
48326
- if (childChild.w?.IsA("Weld") || childChild.w?.IsA("AnimationConstraint")) {
48224
+ if (childChild.w?.IsA("JointInstance") || childChild.w?.IsA("AnimationConstraint")) {
48327
48225
  childChild.Destroy();
48328
48226
  }
48329
48227
  }
48228
+ if (!FLAGS.AVATAR_JOINT_UPGRADE) {
48229
+ moveAttachmentsToBase(head2);
48230
+ }
48330
48231
  replaceBodyPart(rig, head2);
48331
48232
  }
48332
48233
  }
@@ -48340,6 +48241,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48340
48241
  }
48341
48242
  resolve(void 0);
48342
48243
  }
48244
+ dataModel.Destroy();
48343
48245
  }
48344
48246
  });
48345
48247
  }));
@@ -48396,6 +48298,7 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48396
48298
  }
48397
48299
  }
48398
48300
  }
48301
+ dataModel.Destroy();
48399
48302
  resolve(void 0);
48400
48303
  } else {
48401
48304
  resolve(result);
@@ -48439,9 +48342,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48439
48342
  }
48440
48343
  asset.setParent(rig);
48441
48344
  } else {
48442
- dataModel.Destroy();
48443
48345
  warn(false, `Clothing asset does not exist or is invalid`);
48444
48346
  }
48347
+ dataModel.Destroy();
48445
48348
  resolve(void 0);
48446
48349
  } else {
48447
48350
  resolve(rbx);
@@ -48497,9 +48400,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48497
48400
  face.setParent(head);
48498
48401
  }
48499
48402
  } else {
48500
- dataModel.Destroy();
48501
48403
  warn(false, `Face asset does not exist or is invalid`);
48502
48404
  }
48405
+ dataModel.Destroy();
48503
48406
  } else {
48504
48407
  return rbx;
48505
48408
  }
@@ -48545,32 +48448,34 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48545
48448
  if (oldTool) {
48546
48449
  oldTool.Destroy();
48547
48450
  }
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();
48451
+ if (!FLAGS.USE_ASSEMBLY) {
48452
+ const handle = tool.FindFirstChild("Handle");
48453
+ for (const child of tool.GetDescendants()) {
48454
+ if (child.className === "Motor6D" || child.className === "Weld" || child.className === "ManualWeld") {
48455
+ if (child.HasProperty("Part0") && child.HasProperty("Part1") && child.HasProperty("C0") && child.HasProperty("C1") && child.Prop("Part1") === handle) {
48456
+ const part0 = child.Prop("Part0");
48457
+ const part1 = child.Prop("Part1");
48458
+ const c0 = child.Prop("C0");
48459
+ const c1 = child.Prop("C1");
48460
+ child.setProperty("Part0", part1, true);
48461
+ child.setProperty("Part1", part0, true);
48462
+ child.setProperty("C0", c1, true);
48463
+ child.setProperty("C1", c0);
48464
+ } else if (child.HasProperty("Part0") && child.Prop("Part0") === handle) ;
48465
+ else {
48466
+ child.Destroy();
48467
+ }
48468
+ if (!child.destroyed && child.PropOrDefault("Part0", void 0) == void 0 || child.PropOrDefault("Part1", void 0) === void 0) {
48469
+ child.Destroy();
48470
+ }
48566
48471
  }
48567
48472
  }
48568
48473
  }
48569
48474
  tool.setParent(rig);
48570
48475
  } else {
48571
- dataModel.Destroy();
48572
48476
  warn(false, `Gear asset does not exist or is invalid`);
48573
48477
  }
48478
+ dataModel.Destroy();
48574
48479
  } else {
48575
48480
  return rbx;
48576
48481
  }
@@ -48660,9 +48565,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48660
48565
  accessoryDesc.setProperty("Instance", accessory);
48661
48566
  }
48662
48567
  } else {
48663
- dataModel.Destroy();
48664
48568
  warn(false, `Accessory asset does not exist or is invalid`);
48665
48569
  }
48570
+ dataModel.Destroy();
48666
48571
  resolve(void 0);
48667
48572
  } else {
48668
48573
  resolve(rbx);
@@ -48746,9 +48651,9 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48746
48651
  makeupDesc.setProperty("Instance", makeup);
48747
48652
  }
48748
48653
  } else {
48749
- dataModel.Destroy();
48750
48654
  warn(false, `Makeup asset does not exist or is invalid`);
48751
48655
  }
48656
+ dataModel.Destroy();
48752
48657
  resolve(void 0);
48753
48658
  } else {
48754
48659
  resolve(rbx);
@@ -48956,17 +48861,17 @@ class HumanoidDescriptionWrapper extends InstanceWrapper {
48956
48861
  return this.instance;
48957
48862
  }
48958
48863
  }
48959
- const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48864
+ const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48960
48865
  __proto__: null,
48961
48866
  HumanoidDescriptionWrapper
48962
48867
  }, Symbol.toStringTag, { value: "Module" }));
48963
- class WeldWrapperData {
48868
+ class JointInstanceWrapperData {
48964
48869
  part0ChangedConnection;
48965
48870
  lastUpdateTime = 0;
48966
48871
  timeUpdates = 0;
48967
48872
  }
48968
- class WeldWrapper extends InstanceWrapper {
48969
- static className = "Weld";
48873
+ class JointInstanceWrapper extends InstanceWrapper {
48874
+ static className = "JointInstance";
48970
48875
  static requiredProperties = [
48971
48876
  "Name",
48972
48877
  "Enabled",
@@ -48983,7 +48888,7 @@ class WeldWrapper extends InstanceWrapper {
48983
48888
  if (!this.instance.HasProperty("Part1")) this.instance.addProperty(new Property("Part1", DataType.Referent), void 0);
48984
48889
  if (!this.instance.HasProperty("C0")) this.instance.addProperty(new Property("C0", DataType.CFrame), new CFrame());
48985
48890
  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());
48891
+ if (!this.instance.HasProperty("_data")) this.instance.addProperty(new Property("_data", DataType.NonSerializable), new JointInstanceWrapperData());
48987
48892
  }
48988
48893
  get data() {
48989
48894
  return this.instance.Prop("_data");
@@ -49004,10 +48909,42 @@ class WeldWrapper extends InstanceWrapper {
49004
48909
  if (FLAGS.LEGACY_WELD_BEHAVIOR) return;
49005
48910
  const part0 = this.instance.Prop("Part0");
49006
48911
  const part1 = this.instance.Prop("Part1");
49007
- if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
49008
- part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48912
+ if (!FLAGS.USE_ASSEMBLY) {
48913
+ if (part0 && part1 && part1.HasProperty("CFrame") && part0 !== part1) {
48914
+ part1.setProperty("CFrame", traverseRigCFrame(this.instance, true, true));
48915
+ }
49009
48916
  }
49010
48917
  }
48918
+ getAssemblyOffset(includeTransform) {
48919
+ const part0 = this.instance.Prop("Part0");
48920
+ const part1 = this.instance.Prop("Part1");
48921
+ if (part0 && part1 && part0 !== part1) {
48922
+ const part0W = part0.w;
48923
+ const part1W = part1.w;
48924
+ if (part0W && part1W && part0W.IsA("BasePart") && part1W.IsA("BasePart")) {
48925
+ const c0 = this.instance.Prop("C0");
48926
+ const c1 = this.instance.Prop("C1");
48927
+ const transform = this.instance.PropOrDefault("Transform", new CFrame());
48928
+ const an0 = part0W.GetAssemblyNode();
48929
+ const an1 = part1W.GetAssemblyNode();
48930
+ const affectedPart = an0.depth <= an1.depth ? 1 : 0;
48931
+ if (affectedPart === 1) {
48932
+ if (includeTransform) {
48933
+ return c0.multiply(c1.multiply(transform).inverse());
48934
+ } else {
48935
+ return c0.multiply(c1.inverse());
48936
+ }
48937
+ } else if (affectedPart === 0) {
48938
+ if (includeTransform) {
48939
+ return c1.multiply(transform).multiply(c0.inverse());
48940
+ } else {
48941
+ return c1.multiply(c0.inverse());
48942
+ }
48943
+ }
48944
+ }
48945
+ }
48946
+ return new CFrame();
48947
+ }
49011
48948
  update(affectedPart = 1) {
49012
48949
  if (!this.instance.parent) return;
49013
48950
  if (this.data.lastUpdateTime === Date.now()) {
@@ -49059,14 +48996,14 @@ class WeldWrapper extends InstanceWrapper {
49059
48996
  }
49060
48997
  }
49061
48998
  }
49062
- const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48999
+ const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49063
49000
  __proto__: null,
49064
- WeldWrapper
49001
+ JointInstanceWrapper
49065
49002
  }, Symbol.toStringTag, { value: "Module" }));
49066
- class ManualWeldWrapper extends WeldWrapper {
49003
+ class ManualWeldWrapper extends JointInstanceWrapper {
49067
49004
  static className = "ManualWeld";
49068
49005
  }
49069
- const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49006
+ const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49070
49007
  __proto__: null,
49071
49008
  ManualWeldWrapper
49072
49009
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49081,7 +49018,7 @@ class MeshPartWrapper extends BasePartWrapper {
49081
49018
  if (!this.instance.HasProperty("DoubleSided")) this.instance.addProperty(new Property("DoubleSided", DataType.Bool), false);
49082
49019
  }
49083
49020
  }
49084
- const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49021
+ const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49085
49022
  __proto__: null,
49086
49023
  MeshPartWrapper
49087
49024
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49100,11 +49037,11 @@ class ModelWrapper extends InstanceWrapper {
49100
49037
  throw new Error("Model has no PrimaryPart");
49101
49038
  }
49102
49039
  }
49103
- const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49040
+ const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49104
49041
  __proto__: null,
49105
49042
  ModelWrapper
49106
49043
  }, Symbol.toStringTag, { value: "Module" }));
49107
- class Motor6DWrapper extends WeldWrapper {
49044
+ class Motor6DWrapper extends JointInstanceWrapper {
49108
49045
  static className = "Motor6D";
49109
49046
  static requiredProperties = [
49110
49047
  ...super.requiredProperties,
@@ -49115,7 +49052,7 @@ class Motor6DWrapper extends WeldWrapper {
49115
49052
  if (!this.instance.HasProperty("Transform")) this.instance.addProperty(new Property("Transform", DataType.CFrame), new CFrame());
49116
49053
  }
49117
49054
  }
49118
- const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49055
+ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49119
49056
  __proto__: null,
49120
49057
  Motor6DWrapper
49121
49058
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49130,7 +49067,7 @@ class PartWrapper extends BasePartWrapper {
49130
49067
  if (!this.instance.HasProperty("shape")) this.instance.addProperty(new Property("shape", DataType.Enum), PartType.Block);
49131
49068
  }
49132
49069
  }
49133
- const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49070
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49134
49071
  __proto__: null,
49135
49072
  PartWrapper
49136
49073
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49233,7 +49170,7 @@ class SoundWrapper extends InstanceWrapper {
49233
49170
  }
49234
49171
  }
49235
49172
  }
49236
- const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49173
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49237
49174
  __proto__: null,
49238
49175
  SoundWrapper
49239
49176
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49298,7 +49235,7 @@ class ScriptWrapper extends InstanceWrapper {
49298
49235
  }
49299
49236
  }
49300
49237
  }
49301
- const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49238
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49302
49239
  __proto__: null,
49303
49240
  ScriptWrapper
49304
49241
  }, Symbol.toStringTag, { value: "Module" }));
@@ -49355,18 +49292,25 @@ class ToolWrapper extends InstanceWrapper {
49355
49292
  }
49356
49293
  }
49357
49294
  }
49358
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49295
+ const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49359
49296
  __proto__: null,
49360
49297
  ToolWrapper
49361
49298
  }, Symbol.toStringTag, { value: "Module" }));
49362
49299
  class WedgePartWrapper extends BasePartWrapper {
49363
49300
  static className = "WedgePart";
49364
49301
  }
49365
- const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49302
+ const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49366
49303
  __proto__: null,
49367
49304
  WedgePartWrapper
49368
49305
  }, 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 });
49306
+ class WeldWrapper extends JointInstanceWrapper {
49307
+ static className = "Weld";
49308
+ }
49309
+ const __vite_glob_0_25 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49310
+ __proto__: null,
49311
+ WeldWrapper
49312
+ }, Symbol.toStringTag, { value: "Module" }));
49313
+ const modules$1 = /* @__PURE__ */ Object.assign({ "./instance/Accessory.ts": __vite_glob_0_0$1, "./instance/AccessoryDescription.ts": __vite_glob_0_1$1, "./instance/AnimationConstraint.ts": __vite_glob_0_2$1, "./instance/Animator.ts": __vite_glob_0_3, "./instance/Attachment.ts": __vite_glob_0_4, "./instance/BasePart.ts": __vite_glob_0_5, "./instance/BodyColors.ts": __vite_glob_0_6, "./instance/BodyPartDescription.ts": __vite_glob_0_7, "./instance/Bone.ts": __vite_glob_0_8, "./instance/Constraint.ts": __vite_glob_0_9, "./instance/Decal.ts": __vite_glob_0_10, "./instance/FaceControls.ts": __vite_glob_0_11, "./instance/HumanoidDescription.ts": __vite_glob_0_12, "./instance/InstanceWrapper.ts": __vite_glob_0_13, "./instance/JointInstance.ts": __vite_glob_0_14, "./instance/MakeupDescription.ts": __vite_glob_0_15, "./instance/ManualWeld.ts": __vite_glob_0_16, "./instance/MeshPart.ts": __vite_glob_0_17, "./instance/Model.ts": __vite_glob_0_18, "./instance/Motor6D.ts": __vite_glob_0_19, "./instance/Part.ts": __vite_glob_0_20, "./instance/Script.ts": __vite_glob_0_21, "./instance/Sound.ts": __vite_glob_0_22, "./instance/Tool.ts": __vite_glob_0_23, "./instance/WedgePart.ts": __vite_glob_0_24, "./instance/Weld.ts": __vite_glob_0_25 });
49370
49314
  function RegisterWrappers() {
49371
49315
  for (const module of Object.values(modules$1)) {
49372
49316
  for (const exprt of Object.values(module)) {
@@ -51551,7 +51495,10 @@ class OutfitRenderer {
51551
51495
  this.currentRigType = newRigType;
51552
51496
  API.Asset.GetRBX(`roavatar://Rig${this.currentRigType}.rbxm`, void 0).then((result) => {
51553
51497
  if (result instanceof RBX) {
51554
- const newRig = result.generateTree().GetChildren()[0];
51498
+ const dataModel = result.generateTree();
51499
+ const newRig = dataModel.GetChildren()[0];
51500
+ newRig.setParent(void 0);
51501
+ dataModel.Destroy();
51555
51502
  this.currentRig = newRig;
51556
51503
  this.currentlyChangingRig = false;
51557
51504
  RBXRenderer.addInstance(this.currentRig, this.auth, this.renderScene);
@@ -51856,6 +51803,8 @@ export {
51856
51803
  AnimationPropToName,
51857
51804
  AnimationTrack,
51858
51805
  AnimatorWrapper,
51806
+ Assembly,
51807
+ AssemblyNode,
51859
51808
  Asset,
51860
51809
  AssetMeta,
51861
51810
  AssetType,
@@ -51866,6 +51815,7 @@ export {
51866
51815
  AttachmentWrapper,
51867
51816
  Authentication,
51868
51817
  AvatarType,
51818
+ BasePartWrapper,
51869
51819
  BodyColor3s,
51870
51820
  BodyColors,
51871
51821
  BodyColorsWrapper,
@@ -51873,6 +51823,7 @@ export {
51873
51823
  BodyPartDescriptionWrapper,
51874
51824
  BodyPartEnumToNames,
51875
51825
  BodyPartNameToEnum,
51826
+ BoneWrapper,
51876
51827
  BrickColors,
51877
51828
  BuildJoints,
51878
51829
  BundleTypes,
@@ -51886,6 +51837,7 @@ export {
51886
51837
  ColorSequence,
51887
51838
  ColorSequenceKeypoint,
51888
51839
  Connection,
51840
+ ConstraintWrapper,
51889
51841
  Content,
51890
51842
  ContentMap,
51891
51843
  DataType,
@@ -51901,7 +51853,6 @@ export {
51901
51853
  FaceControlsWrapper,
51902
51854
  FileMesh,
51903
51855
  FileMeshBone,
51904
- FileMeshSkinning,
51905
51856
  FileMeshSubset,
51906
51857
  FindFirstMatchingAttachment,
51907
51858
  FullBodyColors,
@@ -51915,6 +51866,7 @@ export {
51915
51866
  InstanceWrapper,
51916
51867
  ItemInfo,
51917
51868
  ItemSort,
51869
+ JointInstanceWrapper,
51918
51870
  LODS,
51919
51871
  LayeredAssetTypes,
51920
51872
  LayeredClothingAssetOrder,
@@ -51925,6 +51877,7 @@ export {
51925
51877
  ManualWeldWrapper,
51926
51878
  MaxOneOfAssetTypes,
51927
51879
  MaxPerAsset,
51880
+ MeshPartWrapper,
51928
51881
  MeshType,
51929
51882
  ModelWrapper,
51930
51883
  Motor6DWrapper,
@@ -51937,6 +51890,7 @@ export {
51937
51890
  OutfitOrigin,
51938
51891
  OutfitRenderer,
51939
51892
  PartType,
51893
+ PartWrapper,
51940
51894
  ParticleEmitterShapeInOut,
51941
51895
  ParticleFlipbookLayout,
51942
51896
  ParticleFlipbookMode,
@@ -51975,6 +51929,7 @@ export {
51975
51929
  Vector32 as Vector3,
51976
51930
  Wait,
51977
51931
  WearableAssetTypes,
51932
+ WedgePartWrapper,
51978
51933
  WeldWrapper,
51979
51934
  WorkerTypeToFunction,
51980
51935
  WrapLayerAutoSkin,
@@ -52036,8 +51991,11 @@ export {
52036
51991
  getOriginalAttachmentOrientation,
52037
51992
  getOriginalAttachmentPosition,
52038
51993
  getOriginalSize,
51994
+ getPartAssemblyScore,
51995
+ getPartsInAssembly_Generate,
52039
51996
  getRandomBetweenInclusive,
52040
51997
  getRigExtentsWorld,
51998
+ getRootAssemblyPart_Generate,
52041
51999
  getThumbnailCameraCFrame,
52042
52000
  getUVtoIndexMap,
52043
52001
  getUVtoIndicesMap,