Refactor: extract shared helpers across scripts, trim remaining doc redundancy
Deduplication pass (44 extractions): - New SmoothedLook: shared smoothed yaw/pitch look tick + view seeding (FirstPersonController, FreeCamController) - New CharacterTeleport: disable-CC-around-teleport idiom (rescue, owner position apply, free-cam sync) - New GeometryUtil: RescaleToUnitScale + TransformBounds (concealment meter/volume, skinned collider baker) - Paint family: canonical map read/write shared between Net and Persistence, snapshot decode, backend stroke dispatch, RebuildBackend, ResolveSeed, chunked RPC send/gate/copy, CamoKnobs/HeightKnobs aggregates, SanitizeFileKey, NewMaskTexture, AdoptAlbedo, FindSlider - Player/modes: GameMode SetPlayerControl/SetPainting/SetOrbitInputEnabled, InputUtil.GameplayKeyPressed, NearestClimbHit, ComputeXRay delegates to ComputeResolutionFreeze, FingerIK TryInPlaneAngle - Match/misc: UnhookSessionCallbacks, SendEmptyNamedMessage, SwapScenes, RunSessionOpAsync, CovarianceEigen, CollectClusterPoints, MatchHud GUIStyle cache, HsvColorPicker rehook, VoxelCenter Documentation pass: remove 6 triplicated doc blocks and 2 restating inline comments left after the previous reduction. Behavior-neutral; hot-path rasterizer loops intentionally untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
066e308cde
commit
2243cc823e
40 files changed
+681
-724
No files matched your search
@@ -73,11 +73,7 @@ public partial class PaintHud
|
||||
return Path.Combine(HudSaveDir, key + ".hudlayout");
|
||||
}
|
||||
|
||||
private static string SanitizeHudKey(string s)
|
||||
{
|
||||
foreach (char c in Path.GetInvalidFileNameChars()) s = s.Replace(c, '_');
|
||||
return s.Replace(' ', '_');
|
||||
}
|
||||
private static string SanitizeHudKey(string s) => MeshPainter.SanitizeFileKey(s);
|
||||
|
||||
[Serializable]
|
||||
private class HudState
|
||||
@@ -224,27 +220,18 @@ public partial class PaintHud
|
||||
// it - once per HUD, so a reset always returns to the genuine material default.
|
||||
if (!_hasDefaultCamo)
|
||||
{
|
||||
_defaults.camoHalfLambert = painter.CamoHalfLambert;
|
||||
_defaults.camoHalfLambertBrightness = painter.CamoHalfLambertBrightness;
|
||||
_defaults.camoSpecularDampen = painter.CamoSpecularDampen;
|
||||
_defaults.occlusionThreshold = painter.OcclusionThreshold;
|
||||
_defaults.heightNormalIntensity = painter.HeightNormalIntensity;
|
||||
_defaults.parallaxIntensity = painter.ParallaxIntensity;
|
||||
CaptureCamoDefaults();
|
||||
_hasDefaultCamo = true;
|
||||
}
|
||||
|
||||
if (_hasPendingCamo)
|
||||
{
|
||||
painter.CamoHalfLambert = _pendingCamo.x;
|
||||
painter.CamoHalfLambertBrightness = _pendingCamo.y;
|
||||
painter.CamoSpecularDampen = _pendingCamo.z;
|
||||
painter.CamoKnobs = _pendingCamo;
|
||||
_hasPendingCamo = false;
|
||||
}
|
||||
if (_hasPendingHeight)
|
||||
{
|
||||
painter.OcclusionThreshold = _pendingHeight.x;
|
||||
painter.HeightNormalIntensity = _pendingHeight.y;
|
||||
painter.ParallaxIntensity = _pendingHeight.z;
|
||||
painter.HeightKnobs = _pendingHeight;
|
||||
_hasPendingHeight = false;
|
||||
}
|
||||
SyncCamoSliders();
|
||||
@@ -471,6 +458,17 @@ public partial class PaintHud
|
||||
_hasDefaults = true;
|
||||
}
|
||||
|
||||
/// <summary>Snapshots the live camo + height knobs into the reset defaults (caller decides _hasDefaultCamo).</summary>
|
||||
private void CaptureCamoDefaults()
|
||||
{
|
||||
_defaults.camoHalfLambert = painter.CamoHalfLambert;
|
||||
_defaults.camoHalfLambertBrightness = painter.CamoHalfLambertBrightness;
|
||||
_defaults.camoSpecularDampen = painter.CamoSpecularDampen;
|
||||
_defaults.occlusionThreshold = painter.OcclusionThreshold;
|
||||
_defaults.heightNormalIntensity = painter.HeightNormalIntensity;
|
||||
_defaults.parallaxIntensity = painter.ParallaxIntensity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the HUD to its authored defaults, exactly as if the saved layout file had been deleted: the
|
||||
/// panels jump back to their prefab positions and every brush value returns to the painter's prefab /
|
||||
@@ -494,14 +492,7 @@ public partial class PaintHud
|
||||
// Reset clicked before the ready-gate captured the camo defaults? keep the live camo rather than
|
||||
// slamming it to the not-yet-filled 0 (which would flatten the material's lighting).
|
||||
if (!_hasDefaultCamo && painter.IsReady)
|
||||
{
|
||||
_defaults.camoHalfLambert = painter.CamoHalfLambert;
|
||||
_defaults.camoHalfLambertBrightness = painter.CamoHalfLambertBrightness;
|
||||
_defaults.camoSpecularDampen = painter.CamoSpecularDampen;
|
||||
_defaults.occlusionThreshold = painter.OcclusionThreshold;
|
||||
_defaults.heightNormalIntensity = painter.HeightNormalIntensity;
|
||||
_defaults.parallaxIntensity = painter.ParallaxIntensity;
|
||||
}
|
||||
CaptureCamoDefaults();
|
||||
|
||||
ApplyValues(painter, _defaults);
|
||||
SyncFromPainter();
|
||||
|
||||
Reference in new issue
Block a user