mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix issue with cutscene actors.
This commit is contained in:
parent
e2252066f1
commit
fc275d584e
6 changed files with 37 additions and 17 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
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;
|
||||||
|
|
@ -35,6 +37,7 @@ public class ActorPanel
|
||||||
private readonly ObjectManager _objects;
|
private readonly ObjectManager _objects;
|
||||||
private readonly DesignManager _designManager;
|
private readonly DesignManager _designManager;
|
||||||
private readonly DatFileService _datFileService;
|
private readonly DatFileService _datFileService;
|
||||||
|
private readonly Condition _conditions;
|
||||||
|
|
||||||
private ActorIdentifier _identifier;
|
private ActorIdentifier _identifier;
|
||||||
private string _actorName = string.Empty;
|
private string _actorName = string.Empty;
|
||||||
|
|
@ -45,7 +48,8 @@ public class ActorPanel
|
||||||
|
|
||||||
public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer,
|
public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer,
|
||||||
EquipmentDrawer equipmentDrawer, IdentifierService identification, AutoDesignApplier autoDesignApplier,
|
EquipmentDrawer equipmentDrawer, IdentifierService identification, AutoDesignApplier autoDesignApplier,
|
||||||
Configuration config, DesignConverter converter, ObjectManager objects, DesignManager designManager, DatFileService datFileService)
|
Configuration config, DesignConverter converter, ObjectManager objects, DesignManager designManager, DatFileService datFileService,
|
||||||
|
Condition conditions)
|
||||||
{
|
{
|
||||||
_selector = selector;
|
_selector = selector;
|
||||||
_stateManager = stateManager;
|
_stateManager = stateManager;
|
||||||
|
|
@ -58,6 +62,7 @@ public class ActorPanel
|
||||||
_objects = objects;
|
_objects = objects;
|
||||||
_designManager = designManager;
|
_designManager = designManager;
|
||||||
_datFileService = datFileService;
|
_datFileService = datFileService;
|
||||||
|
_conditions = conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomizeFlag CustomizeApplicationFlags
|
private CustomizeFlag CustomizeApplicationFlags
|
||||||
|
|
@ -67,7 +72,8 @@ public class ActorPanel
|
||||||
{
|
{
|
||||||
using var group = ImRaii.Group();
|
using var group = ImRaii.Group();
|
||||||
(_identifier, _data) = _selector.Selection;
|
(_identifier, _data) = _selector.Selection;
|
||||||
_lockedRedraw = _identifier.Type is IdentifierType.Special;
|
_lockedRedraw = _identifier.Type is IdentifierType.Special
|
||||||
|
|| _conditions[ConditionFlag.OccupiedInCutSceneEvent];
|
||||||
(_actorName, _actor) = GetHeaderName();
|
(_actorName, _actor) = GetHeaderName();
|
||||||
DrawHeader();
|
DrawHeader();
|
||||||
DrawPanel();
|
DrawPanel();
|
||||||
|
|
@ -134,7 +140,7 @@ public class ActorPanel
|
||||||
if (!ImGui.CollapsingHeader(header))
|
if (!ImGui.CollapsingHeader(header))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _identifier.Type is IdentifierType.Special))
|
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _lockedRedraw))
|
||||||
_stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual);
|
_stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual);
|
||||||
|
|
||||||
if (_customizationDrawer.DrawWetnessState(_state!.ModelData.IsWet(), out var newWetness, _state.IsLocked))
|
if (_customizationDrawer.DrawWetnessState(_state!.ModelData.IsWet(), out var newWetness, _state.IsLocked))
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,9 @@ public class CommandService : IDisposable
|
||||||
_chat.Print(" 》 If multiple design sets have the same name, the first one will be changed.");
|
_chat.Print(" 》 If multiple design sets have the same name, the first one will be changed.");
|
||||||
_chat.Print(" 》 The name is case-insensitive.");
|
_chat.Print(" 》 The name is case-insensitive.");
|
||||||
_chat.Print(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application")
|
_chat.Print(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application")
|
||||||
.AddText(" the design index and flags are required.").BuiltString);
|
.AddText(" the ").AddYellow("design index").AddText(" and ").AddPurple("flags").AddText(" are required.").BuiltString);
|
||||||
_chat.Print(" 》 The design index is the number in front of the relevant design in the automated design set.");
|
_chat.Print(new SeStringBuilder().AddText(" 》 The ").AddYellow("design index")
|
||||||
|
.AddText(" is the number in front of the relevant design in the automated design set.").BuiltString);
|
||||||
_chat.Print(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ")
|
_chat.Print(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ")
|
||||||
.AddPurple("C", true).AddText("ustomizations, ")
|
.AddPurple("C", true).AddText("ustomizations, ")
|
||||||
.AddPurple("E", true).AddText("quipment, ")
|
.AddPurple("E", true).AddText("quipment, ")
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Glamourer.Structs;
|
||||||
using Penumbra.GameData.Actors;
|
using Penumbra.GameData.Actors;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using CustomizeIndex = Glamourer.Customization.CustomizeIndex;
|
using CustomizeIndex = Glamourer.Customization.CustomizeIndex;
|
||||||
|
|
||||||
namespace Glamourer.State;
|
namespace Glamourer.State;
|
||||||
|
|
@ -22,8 +23,8 @@ public class ActorState
|
||||||
|
|
||||||
public readonly ActorIdentifier Identifier;
|
public readonly ActorIdentifier Identifier;
|
||||||
|
|
||||||
public bool AllowsRedraw
|
public bool AllowsRedraw(Condition condition)
|
||||||
=> Identifier.Type is not IdentifierType.Special;
|
=> Identifier.Type is not IdentifierType.Special && !condition[ConditionFlag.OccupiedInCutSceneEvent];
|
||||||
|
|
||||||
/// <summary> This should always represent the unmodified state of the draw object. </summary>
|
/// <summary> This should always represent the unmodified state of the draw object. </summary>
|
||||||
public DesignData BaseData;
|
public DesignData BaseData;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using Glamourer.Events;
|
using Glamourer.Events;
|
||||||
using Glamourer.Services;
|
using Glamourer.Services;
|
||||||
|
|
@ -15,13 +16,15 @@ public class StateEditor
|
||||||
private readonly CustomizationService _customizations;
|
private readonly CustomizationService _customizations;
|
||||||
private readonly HumanModelList _humans;
|
private readonly HumanModelList _humans;
|
||||||
private readonly GPoseService _gPose;
|
private readonly GPoseService _gPose;
|
||||||
|
private readonly Condition _condition;
|
||||||
|
|
||||||
public StateEditor(CustomizationService customizations, HumanModelList humans, ItemManager items, GPoseService gPose)
|
public StateEditor(CustomizationService customizations, HumanModelList humans, ItemManager items, GPoseService gPose, Condition condition)
|
||||||
{
|
{
|
||||||
_customizations = customizations;
|
_customizations = customizations;
|
||||||
_humans = humans;
|
_humans = humans;
|
||||||
_items = items;
|
_items = items;
|
||||||
_gPose = gPose;
|
_gPose = gPose;
|
||||||
|
_condition = condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Change the model id. If the actor is changed from a human to another human, customize and equipData are unused. </summary>
|
/// <summary> Change the model id. If the actor is changed from a human to another human, customize and equipData are unused. </summary>
|
||||||
|
|
@ -49,6 +52,9 @@ public class StateEditor
|
||||||
if (oldIsHuman)
|
if (oldIsHuman)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!state.AllowsRedraw(_condition))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Fix up everything else to make sure the result is a valid human.
|
// Fix up everything else to make sure the result is a valid human.
|
||||||
state.ModelData.Customize = Customize.Default;
|
state.ModelData.Customize = Customize.Default;
|
||||||
state.ModelData.SetDefaultEquipment(_items);
|
state.ModelData.SetDefaultEquipment(_items);
|
||||||
|
|
@ -73,6 +79,9 @@ public class StateEditor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!state.AllowsRedraw(_condition))
|
||||||
|
return false;
|
||||||
|
|
||||||
state.ModelData.LoadNonHuman(modelId, customize, equipData);
|
state.ModelData.LoadNonHuman(modelId, customize, equipData);
|
||||||
state[ActorState.MetaIndex.ModelId] = source;
|
state[ActorState.MetaIndex.ModelId] = source;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
using Glamourer.Events;
|
using Glamourer.Events;
|
||||||
|
|
@ -24,18 +25,20 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
private readonly StateChanged _event;
|
private readonly StateChanged _event;
|
||||||
private readonly StateApplier _applier;
|
private readonly StateApplier _applier;
|
||||||
private readonly StateEditor _editor;
|
private readonly StateEditor _editor;
|
||||||
|
private readonly Condition _condition;
|
||||||
|
|
||||||
private readonly Dictionary<ActorIdentifier, ActorState> _states = new();
|
private readonly Dictionary<ActorIdentifier, ActorState> _states = new();
|
||||||
|
|
||||||
public StateManager(ActorService actors, ItemManager items, StateChanged @event, StateApplier applier, StateEditor editor,
|
public StateManager(ActorService actors, ItemManager items, StateChanged @event, StateApplier applier, StateEditor editor,
|
||||||
HumanModelList humans)
|
HumanModelList humans, Condition condition)
|
||||||
{
|
{
|
||||||
_actors = actors;
|
_actors = actors;
|
||||||
_items = items;
|
_items = items;
|
||||||
_event = @event;
|
_event = @event;
|
||||||
_applier = applier;
|
_applier = applier;
|
||||||
_editor = editor;
|
_editor = editor;
|
||||||
_humans = humans;
|
_humans = humans;
|
||||||
|
_condition = condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator<KeyValuePair<ActorIdentifier, ActorState>> GetEnumerator()
|
public IEnumerator<KeyValuePair<ActorIdentifier, ActorState>> GetEnumerator()
|
||||||
|
|
@ -378,7 +381,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
if (design.DoApplyVisorToggle())
|
if (design.DoApplyVisorToggle())
|
||||||
_editor.ChangeMetaState(state, ActorState.MetaIndex.VisorState, design.DesignData.IsVisorToggled(), source, out _, key);
|
_editor.ChangeMetaState(state, ActorState.MetaIndex.VisorState, design.DesignData.IsVisorToggled(), source, out _, key);
|
||||||
|
|
||||||
var flags = state.AllowsRedraw ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired;
|
var flags = state.AllowsRedraw(_condition) ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired;
|
||||||
_editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key);
|
_editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key);
|
||||||
redraw |= applied.RequiresRedraw();
|
redraw |= applied.RequiresRedraw();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7c483764678c6edb5efd55f056aeaecae144d5fe
|
Subproject commit 1c53c1da5a5c15cb3d37cb99db64c5651b46a551
|
||||||
Loading…
Add table
Add a link
Reference in a new issue