mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 16:27:47 +01:00
Make attributes and shapes completely toggleable.
This commit is contained in:
parent
75f4e66dbf
commit
b48c4f440a
6 changed files with 245 additions and 156 deletions
|
|
@ -106,46 +106,59 @@ public unsafe class ShapeAttributeManager : IRequiredService, IDisposable
|
|||
|
||||
private void UpdateDefaultMasks(Model human, ShpCache cache)
|
||||
{
|
||||
var genderRace = (GenderRace)human.AsHuman->RaceSexId;
|
||||
foreach (var (shape, topIndex) in _temporaryShapes[1])
|
||||
{
|
||||
if (shape.IsWrist() && _temporaryShapes[2].TryGetValue(shape, out var handIndex))
|
||||
if (shape.IsWrist()
|
||||
&& _temporaryShapes[2].TryGetValue(shape, out var handIndex)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Body, _ids[1], genderRace)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Hands, _ids[2], genderRace)
|
||||
&& human.AsHuman->Models[1] is not null
|
||||
&& human.AsHuman->Models[2] is not null)
|
||||
{
|
||||
human.AsHuman->Models[1]->EnabledShapeKeyIndexMask |= 1u << topIndex;
|
||||
human.AsHuman->Models[2]->EnabledShapeKeyIndexMask |= 1u << handIndex;
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Wrists), HumanSlot.Body, HumanSlot.Hands, 1, 2);
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Wrists), genderRace, HumanSlot.Body, HumanSlot.Hands, 1, 2);
|
||||
}
|
||||
|
||||
if (shape.IsWaist() && _temporaryShapes[3].TryGetValue(shape, out var legIndex))
|
||||
if (shape.IsWaist()
|
||||
&& _temporaryShapes[3].TryGetValue(shape, out var legIndex)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Body, _ids[1], genderRace)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Legs, _ids[3], genderRace)
|
||||
&& human.AsHuman->Models[1] is not null
|
||||
&& human.AsHuman->Models[3] is not null)
|
||||
{
|
||||
human.AsHuman->Models[1]->EnabledShapeKeyIndexMask |= 1u << topIndex;
|
||||
human.AsHuman->Models[3]->EnabledShapeKeyIndexMask |= 1u << legIndex;
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Waist), HumanSlot.Body, HumanSlot.Legs, 1, 3);
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Waist), genderRace, HumanSlot.Body, HumanSlot.Legs, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (shape, bottomIndex) in _temporaryShapes[3])
|
||||
{
|
||||
if (shape.IsAnkle() && _temporaryShapes[4].TryGetValue(shape, out var footIndex))
|
||||
if (shape.IsAnkle()
|
||||
&& _temporaryShapes[4].TryGetValue(shape, out var footIndex)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Legs, _ids[3], genderRace)
|
||||
&& !cache.ShouldBeDisabled(shape, HumanSlot.Feet, _ids[4], genderRace)
|
||||
&& human.AsHuman->Models[3] is not null
|
||||
&& human.AsHuman->Models[4] is not null)
|
||||
{
|
||||
human.AsHuman->Models[3]->EnabledShapeKeyIndexMask |= 1u << bottomIndex;
|
||||
human.AsHuman->Models[4]->EnabledShapeKeyIndexMask |= 1u << footIndex;
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Ankles), HumanSlot.Legs, HumanSlot.Feet, 3, 4);
|
||||
CheckCondition(cache.State(ShapeConnectorCondition.Ankles), genderRace, HumanSlot.Legs, HumanSlot.Feet, 3, 4);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
void CheckCondition(IReadOnlyDictionary<ShapeAttributeString, ShapeAttributeHashSet> dict, HumanSlot slot1,
|
||||
void CheckCondition(IReadOnlyDictionary<ShapeAttributeString, ShapeAttributeHashSet> dict, GenderRace genderRace, HumanSlot slot1,
|
||||
HumanSlot slot2, int idx1, int idx2)
|
||||
{
|
||||
if (dict.Count is 0)
|
||||
return;
|
||||
|
||||
foreach (var (shape, set) in dict)
|
||||
{
|
||||
if (set.Contains(slot1, _ids[idx1], GenderRace.Unknown) && _temporaryShapes[idx1].TryGetValue(shape, out var index1))
|
||||
if (set.CheckEntry(slot1, _ids[idx1], genderRace) is true && _temporaryShapes[idx1].TryGetValue(shape, out var index1))
|
||||
human.AsHuman->Models[idx1]->EnabledShapeKeyIndexMask |= 1u << index1;
|
||||
if (set.Contains(slot2, _ids[idx2], GenderRace.Unknown) && _temporaryShapes[idx2].TryGetValue(shape, out var index2))
|
||||
if (set.CheckEntry(slot2, _ids[idx2], genderRace) is true && _temporaryShapes[idx2].TryGetValue(shape, out var index2))
|
||||
human.AsHuman->Models[idx2]->EnabledShapeKeyIndexMask |= 1u << index2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue