From c426522839675a1690cc16529031a9c2ef5cff76 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:05:09 +0200 Subject: [PATCH] SkinRenderer - Replace 'AddCustomModelPart' type checking from exception throwing to writting a trace warning message --- PCK-Studio/Rendering/SkinRenderer.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PCK-Studio/Rendering/SkinRenderer.cs b/PCK-Studio/Rendering/SkinRenderer.cs index 2cd5453d..48a84a90 100644 --- a/PCK-Studio/Rendering/SkinRenderer.cs +++ b/PCK-Studio/Rendering/SkinRenderer.cs @@ -331,11 +331,11 @@ namespace PckStudio.Rendering body ??= new CubeGroupMesh("Body"); body.AddCube(new(-4, 0, -2), new(8, 12, 4), new(16, 16)); body.AddCube(new(-4, 0, -2), new(8, 12, 4), new(16, 32), OverlayScale); - + rightArm ??= new CubeGroupMesh("Right Arm", new Vector3(-5f, -2f, 0f), new Vector3(4f, 2f, 0f)); rightArm.AddCube(new(-3, -2, -2), new(4, 12, 4), new(40, 16)); rightArm.AddCube(new(-3, -2, -2), new(4, 12, 4), new(40, 32), OverlayScale); - + leftArm ??= new CubeGroupMesh("Left Arm", new Vector3(5f, -2f, 0f), new Vector3(-4f, 2f, 0f)); leftArm.AddCube(new(-1, -2, -2), new(4, 12, 4), new(32, 48)); leftArm.AddCube(new(-1, -2, -2), new(4, 12, 4), new(48, 48), inflate: OverlayScale); @@ -783,7 +783,10 @@ namespace PckStudio.Rendering private void AddCustomModelPart(SkinBOX skinBox) { if (!meshStorage.ContainsKey(skinBox.Type)) - throw new KeyNotFoundException(skinBox.Type); + { + Trace.TraceWarning("[{0}@{1}] Invalid BOX Type: '{2}'", nameof(SkinRenderer), nameof(AddCustomModelPart), skinBox.Type); + return; + } CubeGroupMesh cubeMesh = meshStorage[skinBox.Type]; cubeMesh.AddSkinBox(skinBox, autoInflateOverlayParts && skinBox.IsOverlayPart() ? skinBox.Type == "HEADWEAR" ? OverlayScale * 2 : OverlayScale : 0f); @@ -1126,12 +1129,12 @@ namespace PckStudio.Rendering Vector3 translation = cubeMesh.Translation - cubeMesh.Offset; Vector3 pivot = cubeMesh.Pivot + cubeMesh.Offset; transform = Pivot(translation, pivot, transform); - GL.BlendFunc(BlendingFactor.DstAlpha, BlendingFactor.OneMinusSrcAlpha); + GL.BlendFunc(BlendingFactor.DstAlpha, BlendingFactor.OneMinusSrcAlpha); DrawBoundingBox(transform, cubeBoundingBox, OutlineColor); - GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); + GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); + } } } - } // Ground plane