mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Make a reapply event.
This commit is contained in:
parent
0bc9fc872e
commit
22a8ba3f35
9 changed files with 22 additions and 16 deletions
|
|
@ -110,7 +110,7 @@ public partial class GlamourerIpc
|
||||||
foreach (var obj in data.Objects)
|
foreach (var obj in data.Objects)
|
||||||
{
|
{
|
||||||
_autoDesignApplier.ReapplyAutomation(obj, state.Identifier, state);
|
_autoDesignApplier.ReapplyAutomation(obj, state.Identifier, state);
|
||||||
_stateManager.ReapplyState(obj);
|
_stateManager.ReapplyState(obj, StateSource.IpcManual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ public sealed class AutoDesignApplier : IDisposable
|
||||||
{
|
{
|
||||||
Reduce(data.Objects[0], state, newSet, false, false);
|
Reduce(data.Objects[0], state, newSet, false, false);
|
||||||
foreach (var actor in data.Objects)
|
foreach (var actor in data.Objects)
|
||||||
_state.ReapplyState(actor);
|
_state.ReapplyState(actor, StateSource.Fixed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_objects.TryGetValueAllWorld(id, out data) || _objects.TryGetValueNonOwned(id, out data))
|
else if (_objects.TryGetValueAllWorld(id, out data) || _objects.TryGetValueNonOwned(id, out data))
|
||||||
|
|
@ -162,7 +162,7 @@ public sealed class AutoDesignApplier : IDisposable
|
||||||
if (_state.GetOrCreate(specificId, actor, out var state))
|
if (_state.GetOrCreate(specificId, actor, out var state))
|
||||||
{
|
{
|
||||||
Reduce(actor, state, newSet, false, false);
|
Reduce(actor, state, newSet, false, false);
|
||||||
_state.ReapplyState(actor);
|
_state.ReapplyState(actor, StateSource.Fixed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +210,7 @@ public sealed class AutoDesignApplier : IDisposable
|
||||||
var respectManual = state.LastJob == newJob.Id;
|
var respectManual = state.LastJob == newJob.Id;
|
||||||
state.LastJob = actor.Job;
|
state.LastJob = actor.Job;
|
||||||
Reduce(actor, state, set, respectManual, true);
|
Reduce(actor, state, set, respectManual, true);
|
||||||
_state.ReapplyState(actor);
|
_state.ReapplyState(actor, StateSource.Fixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReapplyAutomation(Actor actor, ActorIdentifier identifier, ActorState state)
|
public void ReapplyAutomation(Actor actor, ActorIdentifier identifier, ActorState state)
|
||||||
|
|
@ -310,7 +310,7 @@ public sealed class AutoDesignApplier : IDisposable
|
||||||
Reduce(data.Objects[0], state, set, respectManual, job != state.LastJob);
|
Reduce(data.Objects[0], state, set, respectManual, job != state.LastJob);
|
||||||
NewGearsetId = -1;
|
NewGearsetId = -1;
|
||||||
foreach (var actor in data.Objects)
|
foreach (var actor in data.Objects)
|
||||||
_state.ReapplyState(actor);
|
_state.ReapplyState(actor, StateSource.Fixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe bool CheckGearset(short check)
|
public static unsafe bool CheckGearset(short check)
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@ namespace Glamourer.Events
|
||||||
|
|
||||||
/// <summary> A characters saved state had a meta toggle changed. Data is the old stain id, the new stain id and the slot [(StainId, StainId, EquipSlot)]. </summary>
|
/// <summary> A characters saved state had a meta toggle changed. Data is the old stain id, the new stain id and the slot [(StainId, StainId, EquipSlot)]. </summary>
|
||||||
Other,
|
Other,
|
||||||
|
|
||||||
|
/// <summary> A characters state was reapplied. Data is null. </summary>
|
||||||
|
Reapply,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Priority
|
public enum Priority
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ public sealed class DesignQuickBar : Window, IDisposable
|
||||||
foreach (var actor in data.Objects)
|
foreach (var actor in data.Objects)
|
||||||
{
|
{
|
||||||
_autoDesignApplier.ReapplyAutomation(actor, id, state!);
|
_autoDesignApplier.ReapplyAutomation(actor, id, state!);
|
||||||
_stateManager.ReapplyState(actor);
|
_stateManager.ReapplyState(actor, StateSource.Manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ public class ActorPanel(
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGuiUtil.DrawDisabledButton("Reapply State", Vector2.Zero, "Try to reapply the configured state if something went wrong.",
|
if (ImGuiUtil.DrawDisabledButton("Reapply State", Vector2.Zero, "Try to reapply the configured state if something went wrong.",
|
||||||
_state!.IsLocked))
|
_state!.IsLocked))
|
||||||
_stateManager.ReapplyState(_actor);
|
_stateManager.ReapplyState(_actor, StateSource.Manual);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGuiUtil.DrawDisabledButton("Reapply Automation", Vector2.Zero,
|
if (ImGuiUtil.DrawDisabledButton("Reapply Automation", Vector2.Zero,
|
||||||
|
|
@ -381,7 +381,7 @@ public class ActorPanel(
|
||||||
!_config.EnableAutoDesigns || _state!.IsLocked))
|
!_config.EnableAutoDesigns || _state!.IsLocked))
|
||||||
{
|
{
|
||||||
_autoDesignApplier.ReapplyAutomation(_actor, _identifier, _state!);
|
_autoDesignApplier.ReapplyAutomation(_actor, _identifier, _state!);
|
||||||
_stateManager.ReapplyState(_actor);
|
_stateManager.ReapplyState(_actor, StateSource.Manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
using Glamourer.Services;
|
using Glamourer.Services;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
|
|
@ -54,9 +54,10 @@ public sealed class CmaFile
|
||||||
{
|
{
|
||||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||||
{
|
{
|
||||||
var idx = slot.ToIndex();
|
var idx = slot.ToIndex();
|
||||||
if (idx * 4 + 3 >= byteData.Length)
|
if (idx * 4 + 3 >= byteData.Length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var armor = ((CharacterArmor*)ptr)[idx];
|
var armor = ((CharacterArmor*)ptr)[idx];
|
||||||
var item = items.Identify(slot, armor.Set, armor.Variant);
|
var item = items.Identify(slot, armor.Set, armor.Variant);
|
||||||
data.SetItem(slot, item);
|
data.SetItem(slot, item);
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ public class CommandService : IDisposable
|
||||||
if (_stateManager.GetOrCreate(identifier, actor, out var state))
|
if (_stateManager.GetOrCreate(identifier, actor, out var state))
|
||||||
{
|
{
|
||||||
_autoDesignApplier.ReapplyAutomation(actor, identifier, state);
|
_autoDesignApplier.ReapplyAutomation(actor, identifier, state);
|
||||||
_stateManager.ReapplyState(actor);
|
_stateManager.ReapplyState(actor, StateSource.Manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,7 +357,7 @@ public class CommandService : IDisposable
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (var actor in data.Objects)
|
foreach (var actor in data.Objects)
|
||||||
_stateManager.ReapplyState(actor);
|
_stateManager.ReapplyState(actor, StateSource.Manual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,8 @@ public class StateApplier(
|
||||||
ChangeMetaState(actors, MetaIndex.VisorState, state.ModelData.IsVisorToggled());
|
ChangeMetaState(actors, MetaIndex.VisorState, state.ModelData.IsVisorToggled());
|
||||||
ChangeCrests(actors, state.ModelData.CrestVisibility);
|
ChangeCrests(actors, state.ModelData.CrestVisibility);
|
||||||
ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters, state.IsLocked);
|
ChangeParameters(actors, state.OnlyChangedParameters(), state.ModelData.Parameters, state.IsLocked);
|
||||||
|
foreach (var material in state.Materials.Values)
|
||||||
|
ChangeMaterialValue(actors, MaterialValueIndex.FromKey(material.Key), material.Value.Model, state.IsLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actors;
|
return actors;
|
||||||
|
|
|
||||||
|
|
@ -334,14 +334,14 @@ public sealed class StateManager(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReapplyState(Actor actor)
|
public void ReapplyState(Actor actor, StateSource source)
|
||||||
{
|
{
|
||||||
if (!GetOrCreate(actor, out var state))
|
if (!GetOrCreate(actor, out var state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Applier.ApplyAll(state,
|
var data = Applier.ApplyAll(state,
|
||||||
!actor.Model.IsHuman || CustomizeArray.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(),
|
!actor.Model.IsHuman || CustomizeArray.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(), false);
|
||||||
false);
|
StateChanged.Invoke(StateChanged.Type.Reapply, source, state, data, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteState(ActorIdentifier identifier)
|
public void DeleteState(ActorIdentifier identifier)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue