Model Id stuff.

This commit is contained in:
Ottermandias 2023-07-31 18:27:13 +02:00
parent d1bb2ddefe
commit 87d668411b
2 changed files with 5 additions and 6 deletions

View file

@ -3,7 +3,6 @@ using System.Numerics;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Internal.Notifications;
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.UI;
using Glamourer.Automation; using Glamourer.Automation;
using Glamourer.Customization; using Glamourer.Customization;
using Glamourer.Designs; using Glamourer.Designs;
@ -270,7 +269,7 @@ public class ActorPanel
Description = "Copy the current design to your clipboard.", Description = "Copy the current design to your clipboard.",
Icon = FontAwesomeIcon.Copy, Icon = FontAwesomeIcon.Copy,
OnClick = ExportToClipboard, OnClick = ExportToClipboard,
Visible = _state?.ModelData.IsHuman ?? false, Visible = _state?.ModelData.ModelId == 0,
}; };
private HeaderDrawer.Button SaveAsDesignButton() private HeaderDrawer.Button SaveAsDesignButton()
@ -279,7 +278,7 @@ public class ActorPanel
Description = "Save the current state as a design.", Description = "Save the current state as a design.",
Icon = FontAwesomeIcon.Save, Icon = FontAwesomeIcon.Save,
OnClick = SaveDesignOpen, OnClick = SaveDesignOpen,
Visible = _state?.ModelData.IsHuman ?? false, Visible = _state?.ModelData.ModelId == 0,
}; };
private HeaderDrawer.Button LockedButton() private HeaderDrawer.Button LockedButton()
@ -369,7 +368,7 @@ public class ActorPanel
{ {
var (id, data) = _objects.PlayerData; var (id, data) = _objects.PlayerData;
if (!ImGuiUtil.DrawDisabledButton("Apply to Yourself", Vector2.Zero, "Apply the current state to your own character.", if (!ImGuiUtil.DrawDisabledButton("Apply to Yourself", Vector2.Zero, "Apply the current state to your own character.",
!data.Valid || id == _identifier || !_state!.ModelData.IsHuman)) !data.Valid || id == _identifier || _state!.ModelData.ModelId != 0))
return; return;
if (_stateManager.GetOrCreate(id, data.Objects[0], out var state)) if (_stateManager.GetOrCreate(id, data.Objects[0], out var state))
@ -386,7 +385,7 @@ public class ActorPanel
: "The current target can not be manipulated." : "The current target can not be manipulated."
: "No valid target selected."; : "No valid target selected.";
if (!ImGuiUtil.DrawDisabledButton("Apply to Target", Vector2.Zero, tt, if (!ImGuiUtil.DrawDisabledButton("Apply to Target", Vector2.Zero, tt,
!data.Valid || id == _identifier || !_state!.ModelData.IsHuman || _objects.IsInGPose)) !data.Valid || id == _identifier || _state!.ModelData.ModelId != 0 || _objects.IsInGPose))
return; return;
if (_stateManager.GetOrCreate(id, data.Objects[0], out var state)) if (_stateManager.GetOrCreate(id, data.Objects[0], out var state))

View file

@ -113,7 +113,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
// Model ID is only unambiguously contained in the game object. // Model ID is only unambiguously contained in the game object.
// The draw object only has the object type. // The draw object only has the object type.
// TODO reverse search model data to get model id from model. // TODO reverse search model data to get model id from model.
if (!_humans.IsHuman(ret.ModelId)) if (!_humans.IsHuman((uint)actor.AsCharacter->CharacterData.ModelCharaId))
{ {
ret.LoadNonHuman((uint)actor.AsCharacter->CharacterData.ModelCharaId, *(Customize*)&actor.AsCharacter->DrawData.CustomizeData, ret.LoadNonHuman((uint)actor.AsCharacter->CharacterData.ModelCharaId, *(Customize*)&actor.AsCharacter->DrawData.CustomizeData,
(nint)(&actor.AsCharacter->DrawData.Head)); (nint)(&actor.AsCharacter->DrawData.Head));