Fix some issues with customization IDs and supported counts.

This commit is contained in:
Ottermandias 2025-05-19 17:15:29 +02:00
parent 47b5895404
commit 68b68d6ce7
4 changed files with 16 additions and 5 deletions

@ -1 +1 @@
Subproject commit 8e57c2e12570bb1795efb9e5c6e38617aa8dd5e3
Subproject commit b15c0f07ba270a7b6a350411006e003da9818d1b

View file

@ -5,6 +5,7 @@ using Penumbra.GameData.Data;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.Interop.Structs;
using Penumbra.Meta.Files;
namespace Penumbra.Meta.Manipulations;
@ -98,6 +99,12 @@ public readonly record struct ShpIdentifier(HumanSlot Slot, PrimaryId? Id, Shape
if (Slot is HumanSlot.Unknown && Id is not null)
return false;
if (Slot.ToSpecificEnum() is BodySlot && Id is { Id: > byte.MaxValue })
return false;
if (Id is { Id: > ExpandedEqpGmpBase.Count - 1 })
return false;
if (!ValidateCustomShapeString(Shape))
return false;

View file

@ -70,7 +70,7 @@ public class ShapeManager : IRequiredService, IDisposable
if (model is null || model->ModelResourceHandle is null)
continue;
_ids[(int)modelIndex] = human.GetArmorChanged(modelIndex).Set;
_ids[(int)modelIndex] = human.GetModelId(modelIndex);
ref var shapes = ref model->ModelResourceHandle->Shapes;
foreach (var (shape, index) in shapes.Where(kvp => ShpIdentifier.ValidateCustomShapeString(kvp.Key.Value)))

View file

@ -5,6 +5,7 @@ using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.Meta;
using Penumbra.Meta.Files;
using Penumbra.Meta.Manipulations;
@ -151,9 +152,8 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
}
else
{
if (IdInput("##shpPrimaryId"u8, unscaledWidth, identifier.Id.GetValueOrDefault(0).Id, out var setId, 0,
ExpandedEqpGmpBase.Count - 1,
false))
var max = identifier.Slot.ToSpecificEnum() is BodySlot ? byte.MaxValue : ExpandedEqpGmpBase.Count - 1;
if (IdInput("##shpPrimaryId"u8, unscaledWidth, identifier.Id.GetValueOrDefault(0).Id, out var setId, 0, max, false))
{
identifier = identifier with { Id = setId };
ret = true;
@ -190,6 +190,10 @@ public sealed class ShpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
{
identifier = identifier with
{
Id = identifier.Id.HasValue
? (PrimaryId)Math.Clamp(identifier.Id.Value.Id, 0,
slot.ToSpecificEnum() is BodySlot ? byte.MaxValue : ExpandedEqpGmpBase.Count - 1)
: null,
Slot = slot,
ConnectorCondition = Identifier.ConnectorCondition switch
{