mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix crashes on custom faces.
This commit is contained in:
parent
31cbff497f
commit
68552cb48f
2 changed files with 197 additions and 179 deletions
|
|
@ -1,16 +1,18 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Game.ClientState.Objects.Enums;
|
using Dalamud.Game.ClientState.Objects.Enums;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Logging;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Penumbra.PlayerWatch;
|
using Penumbra.PlayerWatch;
|
||||||
|
|
||||||
namespace Glamourer.Gui
|
namespace Glamourer.Gui;
|
||||||
|
|
||||||
|
internal partial class Interface
|
||||||
{
|
{
|
||||||
internal partial class Interface
|
|
||||||
{
|
|
||||||
public const int CharacterScreenIndex = 240;
|
public const int CharacterScreenIndex = 240;
|
||||||
public const int ExamineScreenIndex = 241;
|
public const int ExamineScreenIndex = 241;
|
||||||
public const int FittingRoomIndex = 242;
|
public const int FittingRoomIndex = 242;
|
||||||
|
|
@ -99,10 +101,17 @@ namespace Glamourer.Gui
|
||||||
if (_currentLabel != label)
|
if (_currentLabel != label)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
_currentSave.LoadCharacter(player);
|
_currentSave.LoadCharacter(player);
|
||||||
_player = player;
|
_player = player;
|
||||||
_currentSave.WriteProtected = !modifiable;
|
_currentSave.WriteProtected = !modifiable;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
PluginLog.Error($"Could not load character {player.Name}s information:\n{e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawSelectionButtons()
|
private void DrawSelectionButtons()
|
||||||
{
|
{
|
||||||
|
|
@ -136,11 +145,18 @@ namespace Glamourer.Gui
|
||||||
if (select == null)
|
if (select == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_currentSave.LoadCharacter(select);
|
||||||
_player = select;
|
_player = select;
|
||||||
_currentLabel = _player.Name.ToString();
|
_currentLabel = _player.Name.ToString();
|
||||||
_currentSave.LoadCharacter(_player);
|
|
||||||
_currentSave.WriteProtected = false;
|
_currentSave.WriteProtected = false;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
PluginLog.Error($"Could not load character {select.Name}s information:\n{e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawPlayerSelector()
|
private void DrawPlayerSelector()
|
||||||
{
|
{
|
||||||
|
|
@ -204,5 +220,4 @@ namespace Glamourer.Gui
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
DrawActorPanel();
|
DrawActorPanel();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,10 +162,13 @@ namespace Glamourer.Gui
|
||||||
var count = set.Count(CustomizationId.FacialFeaturesTattoos);
|
var count = set.Count(CustomizationId.FacialFeaturesTattoos);
|
||||||
using (var _ = ImGuiRaii.NewGroup())
|
using (var _ = ImGuiRaii.NewGroup())
|
||||||
{
|
{
|
||||||
|
var face = set.Race == Race.Hrothgar ? customization.Hairstyle : customization.Face;
|
||||||
|
if (set.Faces.Count <= face)
|
||||||
|
face = 1;
|
||||||
for (var i = 0; i < count; ++i)
|
for (var i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
var enabled = customization.FacialFeature(i);
|
var enabled = customization.FacialFeature(i);
|
||||||
var feature = set.FacialFeature(set.Race == Race.Hrothgar ? customization.Hairstyle : customization.Face, i);
|
var feature = set.FacialFeature(face, i);
|
||||||
var icon = i == count - 1
|
var icon = i == count - 1
|
||||||
? _legacyTattooIcon ?? Glamourer.Customization.GetIcon(feature.IconId)
|
? _legacyTattooIcon ?? Glamourer.Customization.GetIcon(feature.IconId)
|
||||||
: Glamourer.Customization.GetIcon(feature.IconId);
|
: Glamourer.Customization.GetIcon(feature.IconId);
|
||||||
|
|
@ -249,7 +252,7 @@ namespace Glamourer.Gui
|
||||||
var current = set.DataByValue(id, customization[id], out var custom);
|
var current = set.DataByValue(id, customization[id], out var custom);
|
||||||
if (current < 0)
|
if (current < 0)
|
||||||
{
|
{
|
||||||
PluginLog.Warning($"Read invalid customization value {customization[id]} for {id}.");
|
label = $"{label} (Custom #{customization[id]})";
|
||||||
current = 0;
|
current = 0;
|
||||||
custom = set.Data(id, 0);
|
custom = set.Data(id, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue