Skip to content

Commit 2e7d23b

Browse files
committed
cleaned up some code and got rid of the over bearing texts in a few scripts
1 parent 286bffb commit 2e7d23b

5 files changed

Lines changed: 20 additions & 160 deletions

File tree

Basis/Packages/com.basis.framework/BasisUI/Menus/Main Menu Providers/SettingsProviderParts/SettingsProviderPerformanceLimits.cs

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,8 @@
33
using Basis.Scripts.Avatar;
44
using UnityEngine;
55
using UnityEngine.UI;
6-
7-
/// <summary>
8-
/// Settings panel for the opt-in client-side avatar performance limits. Every limit
9-
/// is a (toggle, slider) pair — the toggle flips <c>UsePerfLimit*</c> on, the slider
10-
/// sets the corresponding <c>MaxPerf*</c> threshold. All values live in
11-
/// <see cref="BasisSettingsDefaults"/> and are applied at runtime by
12-
/// <c>SMModuleAvatarPerformanceLimits</c>, which re-evaluates every currently-loaded
13-
/// remote avatar when any value changes.
14-
/// </summary>
156
public static class SettingsProviderPerformanceLimits
167
{
17-
/// <summary>
18-
/// The root RectTransform of the currently-built tab. Captured once at tab
19-
/// creation and read by the toggle callbacks so flipping a limit on/off can
20-
/// trigger a layout rebuild — hiding/showing a slider with <c>SetActive</c>
21-
/// drops it out of the layout pass, but LayoutGroups don't re-flow siblings
22-
/// until somebody calls <c>LayoutRebuilder.ForceRebuildLayoutImmediate</c>.
23-
/// </summary>
248
private static RectTransform _layoutRoot;
259

2610
public static PanelTabPage PerformanceLimitsTab(PanelTabGroup tabGroup)
@@ -33,31 +17,15 @@ public static PanelTabPage PerformanceLimitsTab(PanelTabGroup tabGroup)
3317
RectTransform container = descriptor.ContentParent;
3418
BuildPerformanceLimitsContent(container);
3519

36-
// Use the same tabKey we registered with AddLazyTab — it drives both the
37-
// reset button label and the "navigate back to this tab" hop after the
38-
// reset. Hardcoded English would show that literal string in JP/NL.
3920
SettingsProvider.AddResetPageButton(container, "settings.tab.performancelimits", ResetPerformanceLimitDefaults);
4021

4122
descriptor.ForceRebuild();
4223
return tab;
4324
}
44-
45-
/// <summary>
46-
/// Builds every performance-limit group + control into <paramref name="container"/>
47-
/// without adding a reset button. Used by the standalone tab and by the merged
48-
/// Graphics tab so both share one source of truth.
49-
/// </summary>
5025
public static void BuildPerformanceLimitsContent(RectTransform container)
5126
{
5227
_layoutRoot = container;
5328

54-
// Session-only bypass. Lives at the top so it's the first thing users see
55-
// when they want to quickly check what an avatar actually looks like
56-
// unfiltered. Not wired to BasisSettingsDefaults because it deliberately
57-
// doesn't persist — flipping it writes straight to the runtime flag on
58-
// BasisAvatarPerformanceLimits, which fires OnBypassChanged and pulls
59-
// every affected avatar through the same debounced reconcile as a normal
60-
// limit change.
6129
PanelElementDescriptor bypassGroup =
6230
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
6331
bypassGroup.SetTitle(BasisLocalization.Get("settings.perf.sessionBypass.title"));
@@ -71,17 +39,11 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
7139
BasisAvatarPerformanceLimits.BypassAllLimits = on;
7240
};
7341

74-
// Header explanation. Trim limits (animators, lights, particles, trails, lines,
75-
// cloth, unity colliders) destroy excess components on remote avatars at load
76-
// time and ship on by default. Hard-block limits (triangles, bounds, texture
77-
// memory, material slots, bones) fall back to the loading mesh when tripped;
78-
// only texture memory is on by default at 512 MB.
7942
PanelElementDescriptor intro =
8043
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
8144
intro.SetTitle(BasisLocalization.Get("settings.perf.intro.title"));
8245
intro.SetDescription(BasisLocalization.Get("settings.perf.intro.description"));
8346

84-
// ---------------- Geometry ----------------
8547
PanelElementDescriptor geometry =
8648
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
8749
geometry.SetTitle(BasisLocalization.Get("settings.perf.group.geometry"));
@@ -94,28 +56,20 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
9456
BasisSettingsDefaults.MaxPerfTriangles,
9557
1000, 2_000_000, true, displayMode: ValueDisplayMode.Compact);
9658

97-
// Minimum starts at 10 m — anything smaller rejects a normal humanoid on
98-
// principle, and the bounds check is there to catch 50 m-tall monster
99-
// bundles rather than tune small avatars.
10059
AddLimitPair(geometry.ContentParent,
10160
BasisLocalization.Get("settings.perf.boundsSize.toggle"),
10261
BasisLocalization.Get("settings.perf.boundsSize.slider"),
10362
BasisSettingsDefaults.UsePerfLimitBoundsSize,
10463
BasisSettingsDefaults.MaxPerfBoundsSize,
10564
10f, 50f, false, decimals: 1);
10665

107-
// Hard-block cap. Intended as a guard rail for pathological bundles rather
108-
// than a daily driver — label reflects that so users don't set it low.
109-
// "per avatar" is explicit because bones is the one limit where users
110-
// reasonably ask whether it sums across the room or counts per-player.
11166
AddLimitPair(geometry.ContentParent,
11267
BasisLocalization.Get("settings.perf.bones.toggle"),
11368
BasisLocalization.Get("settings.perf.bones.slider"),
11469
BasisSettingsDefaults.UsePerfLimitBones,
11570
BasisSettingsDefaults.MaxPerfBones,
11671
16, 16384, true, displayMode: ValueDisplayMode.Compact);
11772

118-
// ---------------- Meshes & Materials ----------------
11973
PanelElementDescriptor meshes =
12074
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
12175
meshes.SetTitle(BasisLocalization.Get("settings.perf.group.meshesMaterials"));
@@ -148,7 +102,6 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
148102
BasisSettingsDefaults.MaxPerfTextureMemoryMB,
149103
8, 4096, true);
150104

151-
// ---------------- Physics ----------------
152105
PanelElementDescriptor physics =
153106
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
154107
physics.SetTitle(BasisLocalization.Get("settings.perf.group.physics"));
@@ -160,15 +113,6 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
160113
BasisSettingsDefaults.MaxPerfJiggleBones,
161114
0, 128, true);
162115

163-
// JiggleColliderExample is not in AvatarContentPoliceSelector.asset, so the
164-
// content police strips every instance at load time before this limit could
165-
// ever run. Surface nothing for it in the UI.
166-
// AddLimitPair(physics.ContentParent,
167-
// "Limit Jiggle Colliders", "Max Jiggle Colliders",
168-
// BasisSettingsDefaults.UsePerfLimitJiggleColliders,
169-
// BasisSettingsDefaults.MaxPerfJiggleColliders,
170-
// 0, 64, true);
171-
172116
AddLimitPair(physics.ContentParent,
173117
BasisLocalization.Get("settings.perf.colliders.toggle"),
174118
BasisLocalization.Get("settings.perf.colliders.slider"),
@@ -183,21 +127,10 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
183127
BasisSettingsDefaults.MaxPerfCloth,
184128
0, 16, true);
185129

186-
// ---------------- Effects ----------------
187130
PanelElementDescriptor effects =
188131
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
189132
effects.SetTitle(BasisLocalization.Get("settings.perf.group.effects"));
190133

191-
// UnityEngine.Light is not in AvatarContentPoliceSelector.asset, so the
192-
// content police strips every Light on a downloaded remote avatar before
193-
// this limit could ever run. Addressable (in-build) avatars are curated,
194-
// so lights there are effectively impossible too. Surface nothing for it.
195-
// AddLimitPair(effects.ContentParent,
196-
// "Limit Lights", "Max Lights",
197-
// BasisSettingsDefaults.UsePerfLimitLights,
198-
// BasisSettingsDefaults.MaxPerfLights,
199-
// 0, 32, true);
200-
201134
AddLimitPair(effects.ContentParent,
202135
BasisLocalization.Get("settings.perf.particleSystems.toggle"),
203136
BasisLocalization.Get("settings.perf.particleSystems.slider"),
@@ -219,7 +152,6 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
219152
BasisSettingsDefaults.MaxPerfLineRenderers,
220153
0, 64, true);
221154

222-
// ---------------- Runtime ----------------
223155
PanelElementDescriptor runtime =
224156
PanelElementDescriptor.CreateNew(PanelElementDescriptor.ElementStyles.Group, container);
225157
runtime.SetTitle(BasisLocalization.Get("settings.perf.group.runtime"));
@@ -232,30 +164,15 @@ public static void BuildPerformanceLimitsContent(RectTransform container)
232164
BasisSettingsDefaults.MaxPerfAnimators,
233165
1, 32, true);
234166

235-
// Cilbox script behaviours: each CilboxProxy on a remote avatar is one
236-
// sandboxed MonoBehaviour with its own per-frame Update/FixedUpdate tick.
237167
AddLimitPair(runtime.ContentParent,
238168
BasisLocalization.Get("settings.perf.cilboxBehaviours.toggle"),
239169
BasisLocalization.Get("settings.perf.cilboxBehaviours.slider"),
240170
BasisSettingsDefaults.UsePerfLimitCilboxBehaviours,
241171
BasisSettingsDefaults.MaxPerfCilboxBehaviours,
242172
0, 64, true);
243173

244-
// ---------------- Content Tags ----------------
245-
// Sits at the bottom of the same tab so users see content-safety filters
246-
// alongside perf filters — same mental model ("block this avatar before it
247-
// loads"), different criteria (creator-declared category vs. measured cost).
248174
SettingsProviderContentTags.BuildContentTagsContent(container);
249175
}
250-
251-
/// <summary>
252-
/// Adds a toggle and slider for a single limit. The toggle controls whether the
253-
/// limit is enforced; the slider sets the threshold. When the toggle is off the
254-
/// slider's entire GameObject is hidden so the settings panel only shows the
255-
/// knob for an active limit — matches how VRChat / NeosVR hide inactive options.
256-
/// <paramref name="displayMode"/> lets large-number sliders (triangles, bones)
257-
/// opt into the compact "1k / 32.5k / 2M" readout instead of raw integers.
258-
/// </summary>
259176
private static void AddLimitPair(
260177
Component parent,
261178
string toggleTitle,
@@ -272,18 +189,8 @@ private static void AddLimitPair(
272189
toggle.Descriptor.SetTitle(toggleTitle);
273190
toggle.AssignBinding(useBinding);
274191

275-
PanelSlider slider = PanelSlider.CreateEntryAndBind(
276-
parent,
277-
PanelSlider.SliderSettings.Advanced(sliderTitle, sliderMin, sliderMax, wholeNumbers, decimals, displayMode),
278-
maxBinding);
279-
280-
// Seed visibility from the saved toggle state, then keep it in sync whenever
281-
// the binding flips — including programmatic changes like the reset button.
282-
// SetActive on the slider GameObject removes it from the layout pass entirely
283-
// so the container re-flows and only active limits take up vertical space;
284-
// LayoutRebuilder.ForceRebuildLayoutImmediate is what actually closes / reopens
285-
// the gap. PanelToggle.OnValueChanged only fires from user-driven SetValue,
286-
// so we hook BasisSettingsBinding.OnChanged here to also catch resets.
192+
PanelSlider slider = PanelSlider.CreateEntryAndBind(parent, PanelSlider.SliderSettings.Advanced(sliderTitle, sliderMin, sliderMax, wholeNumbers, decimals, displayMode), maxBinding);
193+
287194
if (slider != null)
288195
{
289196
void Sync(bool on)

Basis/Packages/com.basis.framework/IK/BasisAnimationRiggingHelper.cs

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,41 @@ public static void CreateBasisFullBodyRIG(BasisLocalPlayer player, GameObject pa
1717
// Holder + component
1818
var go = CreateAndSetParent(parent.transform, $"Full IK ({parent.name})");
1919
BasisFullIKConstraint = BasisHelpers.GetOrAddComponent<BasisFullBodyIK>(go);
20-
21-
// ----------------------------
22-
// Core: grab data (local copy)
23-
// ----------------------------
2420
var data = BasisFullIKConstraint.data;
25-
26-
// ----------------------------
27-
// Skeleton references
28-
// ----------------------------
2921
// Torso / head chain
3022
data.hips = Mapping.Hips;
3123
data.spine = Mapping.spine;
3224
data.chest = Mapping.chest;
3325
data.upperChest = Mapping.Upperchest;
3426
data.neck = Mapping.neck;
3527
data.head = Mapping.head;
36-
3728
// Shoulders
3829
data.LeftShoulder = Mapping.leftShoulder;
3930
data.RightShoulder = Mapping.RightShoulder;
40-
4131
// Arms
4232
data.leftUpperArm = Mapping.leftUpperArm;
4333
data.leftLowerArm = Mapping.leftLowerArm;
4434
data.LeftHand = Mapping.leftHand;
4535
data.RightUpperArm = Mapping.RightUpperArm;
4636
data.RightLowerArm = Mapping.RightLowerArm;
4737
data.RightHand = Mapping.rightHand;
48-
4938
// Optional twist bones (auto-detected from rig hierarchy; null when not present)
5039
data.LeftUpperArmTwist = Mapping.leftUpperArmTwist;
5140
data.LeftLowerArmTwist = Mapping.leftLowerArmTwist;
5241
data.RightUpperArmTwist = Mapping.RightUpperArmTwist;
5342
data.RightLowerArmTwist = Mapping.RightLowerArmTwist;
54-
5543
// Legs
5644
data.LeftUpperLeg = Mapping.LeftUpperLeg;
5745
data.LeftLowerLeg = Mapping.LeftLowerLeg;
5846
data.leftFoot = Mapping.leftFoot;
59-
6047
data.RightUpperLeg = Mapping.RightUpperLeg;
6148
data.RightLowerLeg = Mapping.RightLowerLeg;
6249
data.RightFoot = Mapping.rightFoot;
63-
6450
// Toes
6551
data.LeftToe = Mapping.leftToe;
6652
data.RightToe = Mapping.rightToe;
67-
68-
// ----------------------------
69-
// Calibration defaults
70-
// ----------------------------
7153
// Head
7254
data.m_CalibratedRotationHead = Mapping.Hashead ? Mapping.head.rotation : Quaternion.identity;
73-
7455
// Feet
7556
data.M_CalibrationLeftFootRotation = Mapping.Hashead ? Mapping.leftFoot.rotation : Quaternion.identity;
7657
data.M_CalibrationRightFootRotation = Mapping.Hashead ? Mapping.rightFoot.rotation : Quaternion.identity;
@@ -114,11 +95,6 @@ public static void CreateBasisFullBodyRIG(BasisLocalPlayer player, GameObject pa
11495
data.m_CalibratedRotationRightShoulder = Mapping.HasRightShoulder ? Mapping.RightShoulder.rotation : Quaternion.identity;
11596
// Hips reference rotation
11697
data.OffsetRotationHips = Mapping.HasHips ? Mapping.Hips.rotation : Quaternion.identity;
117-
118-
119-
// ----------------------------
120-
// Targets & hints
121-
// ----------------------------
12298
// Head
12399
data.PositionHead = BasisLocalBoneDriver.HeadControl.OutgoingWorldData.position;
124100
data.RotationHead = BasisLocalBoneDriver.HeadControl.OutgoingWorldData.rotation;
@@ -145,30 +121,25 @@ public static void CreateBasisFullBodyRIG(BasisLocalPlayer player, GameObject pa
145121
// Cache world data once per control (less property spam, easier to read)
146122
var leftLowerArm = BasisLocalBoneDriver.LeftLowerArmControl.OutgoingWorldData;
147123
var rightLowerArm = BasisLocalBoneDriver.RightLowerArmControl.OutgoingWorldData;
148-
149124
var chest = BasisLocalBoneDriver.ChestControl.OutgoingWorldData;
150-
151125
var leftLowerLeg = BasisLocalBoneDriver.LeftLowerLegControl.OutgoingWorldData;
152126
var rightLowerLeg = BasisLocalBoneDriver.RightLowerLegControl.OutgoingWorldData;
153-
154127
var leftShoulder = BasisLocalBoneDriver.LeftShoulderControl.OutgoingWorldData;
155128
var rightShoulder = BasisLocalBoneDriver.RightShoulderControl.OutgoingWorldData;
156129

157130
// --- Arms ---
158131
data.LeftLowerArmPosition = BasisLocalRigDriver.ApplyHintBias(Basis.Scripts.TransformBinders.BoneControl.BasisBoneTrackedRole.LeftLowerArm, leftLowerArm.position, leftLowerArm.rotation);
159132
data.LeftLowerArmRotation = leftLowerArm.rotation;
160-
161133
data.RightLowerArmPosition = BasisLocalRigDriver.ApplyHintBias(Basis.Scripts.TransformBinders.BoneControl.BasisBoneTrackedRole.RightLowerArm, rightLowerArm.position, rightLowerArm.rotation);
162134
data.RightLowerArmRotation = rightLowerArm.rotation;
163135

164-
// --- Shoulders (rotation only in your data model) ---
136+
// --- Shoulders ---
165137
data.LeftShoulderRotation = leftShoulder.rotation;
166138
data.RightShoulderRotation = rightShoulder.rotation;
167139

168140
// --- Legs ---
169141
data.PositionLeftLowerLeg = BasisLocalRigDriver.ApplyHintBias(Basis.Scripts.TransformBinders.BoneControl.BasisBoneTrackedRole.LeftLowerLeg, leftLowerLeg.position, leftLowerLeg.rotation);
170142
data.RotationLeftLowerLeg = leftLowerLeg.rotation;
171-
172143
data.PositionRightLowerLeg = BasisLocalRigDriver.ApplyHintBias(Basis.Scripts.TransformBinders.BoneControl.BasisBoneTrackedRole.RightLowerLeg, rightLowerLeg.position, rightLowerLeg.rotation);
173144
data.RotationRightLowerLeg = rightLowerLeg.rotation;
174145

@@ -200,18 +171,22 @@ public static void CreateBasisFullBodyRIG(BasisLocalPlayer player, GameObject pa
200171
private static (bool valid, Vector3 pos) GetLM(Transform[] arr, int i)
201172
{
202173
if (arr != null && i >= 0 && i < arr.Length && arr[i] != null)
174+
{
203175
return (true, arr[i].position);
176+
}
204177

205178
return (false, Vector3.zero);
206179
}
207180
private static Quaternion ComputeHandRotationWithFallback( Vector3 wrist,(bool valid, Vector3 pos)[] pointsA,(bool valid, Vector3 pos)[] pointsB, ref bool hasLast, ref Quaternion lastRot)
208181
{
209-
// pointsA[i] pairs with pointsB[i] as a candidate
210-
for (int i = 0; i < pointsA.Length; i++)
182+
for (int Index = 0; Index < pointsA.Length; Index++)
211183
{
212-
if (!pointsA[i].valid || !pointsB[i].valid) continue;
184+
if (!pointsA[Index].valid || !pointsB[Index].valid)
185+
{
186+
continue;
187+
}
213188

214-
Quaternion rot = HandRotationFromLandmarks(wrist, pointsA[i].pos, pointsB[i].pos);
189+
Quaternion rot = HandRotationFromLandmarks(wrist, pointsA[Index].pos, pointsB[Index].pos);
215190
if (rot == Quaternion.identity) continue;
216191

217192
lastRot = rot;
@@ -240,10 +215,7 @@ public static Quaternion HandRotationFromLandmarks(Vector3 wrist, Vector3 indexM
240215
{
241216
return Quaternion.identity;
242217
}
243-
244218
up.Normalize();
245-
right = Vector3.Cross(up, forward).normalized;
246-
247219
return Quaternion.LookRotation(forward, up);
248220
}
249221
public static void GeneratedRequiredTransforms(BasisLocalPlayer player,Transform baseLevel)

Basis/Packages/com.basis.framework/IK/BasisArmBendLookup.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Runtime.CompilerServices;
22
using Unity.Collections;
3-
using UnityEngine;
43

54
namespace UnityEngine.Animations.Rigging
65
{
@@ -38,9 +37,6 @@ public static Vector3[] GenerateDefaultTable(bool isLeft)
3837

3938
// Default bend direction heuristics (from HVR-IK's multi-factor approach):
4039
Vector3 bendDir;
41-
42-
// How much the hand is outward vs inward
43-
float outwardness = Mathf.Clamp01(isLeft ? -x : x);
4440
// How much the hand is forward
4541
float forwardness = Mathf.Clamp01(z);
4642
// How much the hand is above

0 commit comments

Comments
 (0)