mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Remove no longer needed helpers.
This commit is contained in:
parent
d256702005
commit
fb2b676ff0
3 changed files with 9 additions and 21 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
||||
using FFXIVClientStructs.Interop;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Interop.Material;
|
||||
|
|
@ -79,8 +80,7 @@ public sealed unsafe class AdvancedDyePopup(
|
|||
|
||||
private (string Path, string GamePath) ResourceName(MaterialValueIndex index)
|
||||
{
|
||||
var materialHandle =
|
||||
_actor.Model.AsCharacterBase->Materials()[index.MaterialIndex + index.SlotIndex * MaterialService.MaterialsPerModel].Value;
|
||||
var materialHandle = (MaterialResourceHandle*)_actor.Model.AsCharacterBase->MaterialsSpan[index.MaterialIndex + index.SlotIndex * MaterialService.MaterialsPerModel].Value;
|
||||
var model = _actor.Model.AsCharacterBase->ModelsSpan[index.SlotIndex].Value;
|
||||
var modelHandle = model == null ? null : model->ModelResourceHandle;
|
||||
var path = materialHandle == null
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ public static unsafe class MaterialService
|
|||
return null;
|
||||
|
||||
var index = modelSlot * MaterialsPerModel + materialSlot;
|
||||
if (index < 0 || index >= model.AsCharacterBase->ColorTableTextures().Length)
|
||||
if (index < 0 || index >= model.AsCharacterBase->ColorTableTexturesSpan.Length)
|
||||
return null;
|
||||
|
||||
var texture = (Texture**)Unsafe.AsPointer(ref model.AsCharacterBase->ColorTableTextures()[index]);
|
||||
var texture = (Texture**)Unsafe.AsPointer(ref model.AsCharacterBase->ColorTableTexturesSpan[index]);
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
|
@ -59,10 +59,10 @@ public static unsafe class MaterialService
|
|||
return null;
|
||||
|
||||
var index = modelSlot * MaterialsPerModel + materialSlot;
|
||||
if (index < 0 || index >= model.AsCharacterBase->Materials().Length)
|
||||
if (index < 0 || index >= model.AsCharacterBase->MaterialsSpan.Length)
|
||||
return null;
|
||||
|
||||
var material = model.AsCharacterBase->Materials()[index].Value;
|
||||
var material = (MaterialResourceHandle*) model.AsCharacterBase->MaterialsSpan[index].Value;
|
||||
if (material == null || material->ColorTable == null)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
||||
using FFXIVClientStructs.Interop;
|
||||
using Newtonsoft.Json;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
|
@ -81,13 +79,13 @@ public readonly record struct MaterialValueIndex(
|
|||
{
|
||||
if (!TryGetModel(actor, out var model)
|
||||
|| SlotIndex >= model.AsCharacterBase->SlotCount
|
||||
|| model.AsCharacterBase->ColorTableTextures().Length < (SlotIndex + 1) * MaterialService.MaterialsPerModel)
|
||||
|| model.AsCharacterBase->ColorTableTexturesSpan.Length < (SlotIndex + 1) * MaterialService.MaterialsPerModel)
|
||||
{
|
||||
textures = [];
|
||||
return false;
|
||||
}
|
||||
|
||||
textures = model.AsCharacterBase->ColorTableTextures().Slice(SlotIndex * MaterialService.MaterialsPerModel,
|
||||
textures = model.AsCharacterBase->ColorTableTexturesSpan.Slice(SlotIndex * MaterialService.MaterialsPerModel,
|
||||
MaterialService.MaterialsPerModel);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -192,14 +190,4 @@ public readonly record struct MaterialValueIndex(
|
|||
JsonSerializer serializer)
|
||||
=> FromKey(serializer.Deserialize<uint>(reader), out var value) ? value : throw new Exception($"Invalid material key {value.Key}.");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Remove when fixed in CS.
|
||||
public static class ColorTableExtension
|
||||
{
|
||||
public static unsafe Span<Pointer<MaterialResourceHandle>> Materials(this ref CharacterBase character)
|
||||
=> new(character.Materials, character.SlotCount * MaterialService.MaterialsPerModel);
|
||||
|
||||
public static unsafe Span<Pointer<Texture>> ColorTableTextures(this ref CharacterBase character)
|
||||
=> new(character.ColorTableTextures, character.SlotCount * MaterialService.MaterialsPerModel);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue