mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix some advanced state applications.
This commit is contained in:
parent
c9160b8167
commit
85d9dea2dd
5 changed files with 26 additions and 9 deletions
|
|
@ -41,6 +41,6 @@ public partial class GlamourerIpc
|
|||
return null;
|
||||
}
|
||||
|
||||
return _designConverter.ShareBase64(state, ApplicationRules.All);
|
||||
return _designConverter.ShareBase64(state, ApplicationRules.AllWithConfig(_config));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ public sealed partial class GlamourerIpc : IDisposable
|
|||
private readonly AutoDesignApplier _autoDesignApplier;
|
||||
private readonly DesignManager _designManager;
|
||||
private readonly ItemManager _items;
|
||||
private readonly Configuration _config;
|
||||
|
||||
public GlamourerIpc(DalamudPluginInterface pi, StateManager stateManager, ObjectManager objects, ActorManager actors,
|
||||
DesignConverter designConverter, StateChanged stateChangedEvent, GPoseService gPose, AutoDesignApplier autoDesignApplier,
|
||||
DesignManager designManager, ItemManager items)
|
||||
DesignManager designManager, ItemManager items, Configuration config)
|
||||
{
|
||||
_stateManager = stateManager;
|
||||
_objects = objects;
|
||||
|
|
@ -36,6 +37,7 @@ public sealed partial class GlamourerIpc : IDisposable
|
|||
_designConverter = designConverter;
|
||||
_autoDesignApplier = autoDesignApplier;
|
||||
_items = items;
|
||||
_config = config;
|
||||
_gPose = gPose;
|
||||
_stateChangedEvent = stateChangedEvent;
|
||||
_designManager = designManager;
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@ public readonly struct ApplicationRules(
|
|||
CustomizeFlag customize,
|
||||
CrestFlag crest,
|
||||
CustomizeParameterFlag parameters,
|
||||
MetaFlag meta)
|
||||
MetaFlag meta,
|
||||
bool materials)
|
||||
{
|
||||
public static readonly ApplicationRules All = new(EquipFlagExtensions.All, CustomizeFlagExtensions.AllRelevant,
|
||||
CrestExtensions.AllRelevant, CustomizeParameterExtensions.All, MetaExtensions.All);
|
||||
CrestExtensions.AllRelevant, CustomizeParameterExtensions.All, MetaExtensions.All, true);
|
||||
|
||||
public static ApplicationRules FromModifiers(ActorState state)
|
||||
=> FromModifiers(state, ImGui.GetIO().KeyCtrl, ImGui.GetIO().KeyShift);
|
||||
|
|
@ -22,14 +23,17 @@ public readonly struct ApplicationRules(
|
|||
=> NpcFromModifiers(ImGui.GetIO().KeyCtrl, ImGui.GetIO().KeyShift);
|
||||
|
||||
public static ApplicationRules AllButParameters(ActorState state)
|
||||
=> new(All.Equip, All.Customize, All.Crest, ComputeParameters(state.ModelData, state.BaseData, All.Parameters), All.Meta);
|
||||
=> new(All.Equip, All.Customize, All.Crest, ComputeParameters(state.ModelData, state.BaseData, All.Parameters), All.Meta, true);
|
||||
|
||||
public static ApplicationRules AllWithConfig(Configuration config)
|
||||
=> new(All.Equip, All.Customize, All.Crest, config.UseAdvancedParameters ? All.Parameters : 0, All.Meta, config.UseAdvancedDyes);
|
||||
|
||||
public static ApplicationRules NpcFromModifiers(bool ctrl, bool shift)
|
||||
=> new(ctrl || !shift ? EquipFlagExtensions.All : 0,
|
||||
!ctrl || shift ? CustomizeFlagExtensions.AllRelevant : 0,
|
||||
0,
|
||||
0,
|
||||
ctrl || !shift ? MetaFlag.VisorState : 0);
|
||||
ctrl || !shift ? MetaFlag.VisorState : 0, false);
|
||||
|
||||
public static ApplicationRules FromModifiers(ActorState state, bool ctrl, bool shift)
|
||||
{
|
||||
|
|
@ -41,7 +45,7 @@ public readonly struct ApplicationRules(
|
|||
if (equip != 0)
|
||||
meta |= MetaFlag.HatState | MetaFlag.WeaponState | MetaFlag.VisorState;
|
||||
|
||||
return new ApplicationRules(equip, customize, crest, ComputeParameters(state.ModelData, state.BaseData, parameters), meta);
|
||||
return new ApplicationRules(equip, customize, crest, ComputeParameters(state.ModelData, state.BaseData, parameters), meta, equip != 0);
|
||||
}
|
||||
|
||||
public void Apply(DesignBase design)
|
||||
|
|
@ -68,7 +72,10 @@ public readonly struct ApplicationRules(
|
|||
public MetaFlag Meta
|
||||
=> meta & MetaExtensions.All;
|
||||
|
||||
public static CustomizeParameterFlag ComputeParameters(in DesignData model, in DesignData game,
|
||||
public bool Materials
|
||||
=> materials;
|
||||
|
||||
private static CustomizeParameterFlag ComputeParameters(in DesignData model, in DesignData game,
|
||||
CustomizeParameterFlag baseFlags = CustomizeParameterExtensions.All)
|
||||
{
|
||||
foreach (var flag in baseFlags.Iterate())
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ public class DesignConverter(
|
|||
var design = _designs.CreateTemporary();
|
||||
rules.Apply(design);
|
||||
design.SetDesignData(_customize, data);
|
||||
ComputeMaterials(design.GetMaterialDataRef(), materials, rules.Equip);
|
||||
if (rules.Materials)
|
||||
ComputeMaterials(design.GetMaterialDataRef(), materials, rules.Equip);
|
||||
return design;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,6 +235,13 @@ public class StateEditor(
|
|||
settings.Key))
|
||||
requiresRedraw |= changed.RequiresRedraw();
|
||||
|
||||
if (settings.ResetMaterials)
|
||||
{
|
||||
state.ModelData.Parameters = state.BaseData.Parameters;
|
||||
foreach (var parameter in CustomizeParameterExtensions.AllFlags)
|
||||
state.Sources[parameter] = StateSource.Game;
|
||||
}
|
||||
|
||||
foreach (var parameter in mergedDesign.Design.ApplyParameters.Iterate())
|
||||
{
|
||||
if (settings.RespectManual && state.Sources[parameter].IsManual())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue