Make human.pbd moddable

This commit is contained in:
Exter-N 2024-03-26 02:29:07 +01:00
parent 12532dee28
commit efdd5a824b
11 changed files with 202 additions and 12 deletions

View file

@ -1,4 +1,3 @@
using Dalamud.Game.ClientState.Objects.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
@ -6,6 +5,7 @@ using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using Penumbra.GameData.Data;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.Interop.Services;
using Penumbra.UI;
using CustomizeData = FFXIVClientStructs.FFXIV.Client.Game.Character.CustomizeData;
using CustomizeIndex = Dalamud.Game.ClientState.Objects.Enums.CustomizeIndex;
@ -155,6 +155,22 @@ public class ResourceTree
{
var genericContext = globalContext.CreateContext(&human->CharacterBase);
var cache = globalContext.Collection._cache;
if (cache != null && cache.LoadedResources.TryGetValue(PreBoneDeformerReplacer.PreBoneDeformerPath, out var pbdHandle))
{
var pbdNode = genericContext.CreateNodeFromPbd(pbdHandle.ResourceHandle);
if (pbdNode != null)
{
if (globalContext.WithUiData)
{
pbdNode = pbdNode.Clone();
pbdNode.FallbackName = "Racial Deformer";
pbdNode.Icon = ChangedItemDrawer.ChangedItemIcon.Customization;
}
Nodes.Add(pbdNode);
}
}
var decalId = (byte)(human->Customize[(int)CustomizeIndex.Facepaint] & 0x7F);
var decalPath = decalId != 0
? GamePaths.Human.Decal.FaceDecalPath(decalId)